
com.alachisoft.ncache.client.internal.command.MessageCountCommand Maven / Gradle / Ivy
package com.alachisoft.ncache.client.internal.command;
import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.alachisoft.ncache.common.protobuf.MessageCountCommandProtocol;
import com.alachisoft.ncache.runtime.exceptions.CommandException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public final class MessageCountCommand extends Command
{
private com.alachisoft.ncache.common.protobuf.MessageCountCommandProtocol.MessageCountCommand _commandInstance;
com.alachisoft.ncache.common.protobuf.MessageCountCommandProtocol.MessageCountCommand.Builder _messageCountCommand;
public MessageCountCommand(String topicName)
{
name = "MessageCountCommand";
_messageCountCommand = MessageCountCommandProtocol.MessageCountCommand.newBuilder();
_messageCountCommand.setTopicName(topicName);
_messageCountCommand.setRequestId(super.getRequestId());
}
@Override
public RequestType getCommandRequestType()
{
return RequestType.AtomicRead;
}
@Override
public CommandType getCommandType()
{
return CommandType.MESSAGE_COUNT;
}
@Override
public boolean getIsKeyBased()
{
return false;
}
@Override
protected void createCommand() throws CommandException {
_messageCountCommand.setRequestId(super.getRequestId());
_commandInstance = _messageCountCommand.build();
}
@Override
protected short getCommandHandle()
{
return (short) CommandProtocol.Command.Type.MESSAGE_COUNT.getNumber();
}
@Override
protected void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException
{
_commandInstance.writeTo(stream);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy