Class PacketImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl
-
- All Implemented Interfaces:
Packet
- Direct Known Subclasses:
ActiveMQExceptionMessage,BackupRegistrationMessage,BackupReplicationStartFailedMessage,BackupRequestMessage,BackupResponseMessage,CheckFailoverMessage,CheckFailoverReplyMessage,ClusterConnectMessage,ClusterConnectReplyMessage,ClusterTopologyChangeMessage,CreateAddressMessage,CreateQueueMessage,CreateSessionMessage,CreateSessionResponseMessage,CreateSharedQueueMessage,DisconnectConsumerMessage,DisconnectConsumerWithKillMessage,DisconnectMessage,FederationStreamConnectMessage,MessagePacket,NodeAnnounceMessage,NullResponseMessage,PacketsConfirmedMessage,Ping,QueueAbstractPacket,QuorumVoteMessage,QuorumVoteReplyMessage,ReattachSessionMessage,ReattachSessionResponseMessage,ReplicationAddMessage,ReplicationAddTXMessage,ReplicationCommitMessage,ReplicationDeleteMessage,ReplicationDeleteTXMessage,ReplicationLargeMessageBeginMessage,ReplicationLargeMessageEndMessage,ReplicationLargeMessageWriteMessage,ReplicationLiveIsStoppingMessage,ReplicationPageEventMessage,ReplicationPageWriteMessage,ReplicationPrepareMessage,ReplicationResponseMessage,ReplicationStartSyncMessage,ReplicationSyncFileMessage,RollbackMessage,ScaleDownAnnounceMessage,SessionAcknowledgeMessage,SessionAddMetaDataMessage,SessionAddMetaDataMessageV2,SessionBindingQueryResponseMessage,SessionCloseMessage,SessionCommitMessage,SessionConsumerCloseMessage,SessionConsumerFlowCreditMessage,SessionContinuationMessage,SessionDeleteQueueMessage,SessionExpireMessage,SessionForceConsumerDelivery,SessionIndividualAcknowledgeMessage,SessionProducerCreditsFailMessage,SessionProducerCreditsMessage,SessionQueueQueryResponseMessage,SessionReceiveLargeMessage,SessionRequestProducerCreditsMessage,SessionSendLargeMessage,SessionXAAfterFailedMessage,SessionXACommitMessage,SessionXAEndMessage,SessionXAForgetMessage,SessionXAGetInDoubtXidsResponseMessage,SessionXAGetTimeoutResponseMessage,SessionXAJoinMessage,SessionXAPrepareMessage,SessionXAResponseMessage,SessionXAResumeMessage,SessionXARollbackMessage,SessionXASetTimeoutMessage,SessionXASetTimeoutResponseMessage,SessionXAStartMessage,SubscribeClusterTopologyUpdatesMessage
public class PacketImpl extends Object implements Packet
-
-
Field Summary
-
Fields inherited from interface org.apache.activemq.artemis.core.protocol.core.Packet
INITIAL_PACKET_SIZE
-
-
Constructor Summary
Constructors Constructor Description PacketImpl(byte type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleStringconvertName(SimpleString name)protected static io.netty.buffer.ByteBufcopyMessageBuffer(io.netty.buffer.ByteBuf buffer, int skipBytes)protected ActiveMQBuffercreatePacket(CoreRemotingConnection connection)voiddecode(ActiveMQBuffer buffer)decodes the buffer into this packetvoiddecodeRest(ActiveMQBuffer buffer)ActiveMQBufferencode(CoreRemotingConnection connection)Encodes the packet and returns aActiveMQBuffercontaining the dataprotected voidencodeHeader(ActiveMQBuffer buffer)voidencodeRest(ActiveMQBuffer buffer)voidencodeRest(ActiveMQBuffer buffer, CoreRemotingConnection coreRemotingConnection)protected voidencodeSize(ActiveMQBuffer buffer)booleanequals(Object obj)longgetChannelID()Returns the channel id of the channel that should handle this packet.longgetCorrelationID()intgetPacketSize()returns the size needed to encode this packet.protected StringgetPacketString()bytegetType()returns the type of the packet.inthashCode()booleanisRequiresConfirmations()returns true if a confirmation should be sent on receipt of this packet.booleanisRequiresResponse()booleanisResponse()returns true if this packet is being sent in response to a previously received packetbooleanisResponseAsync()protected intnullableStringEncodeSize(String str)voidsetChannelID(long channelID)Sets the channel id that should be used once the packet has been successfully decoded it is sent to the correct channel.voidsetCorrelationID(long correlationID)StringtoString()extensions of this class are supposed to use getPacketString to provide toString functionality-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.protocol.core.Packet
expectedEncodeSize, release
-
-
-
-
Field Detail
-
ADDRESSING_CHANGE_VERSION
public static final int ADDRESSING_CHANGE_VERSION
- See Also:
- Constant Field Values
-
ARTEMIS_2_7_0_VERSION
public static final int ARTEMIS_2_7_0_VERSION
- See Also:
- Constant Field Values
-
ASYNC_RESPONSE_CHANGE_VERSION
public static final int ASYNC_RESPONSE_CHANGE_VERSION
- See Also:
- Constant Field Values
-
CONSUMER_PRIORITY_CHANGE_VERSION
public static final int CONSUMER_PRIORITY_CHANGE_VERSION
- See Also:
- Constant Field Values
-
FQQN_CHANGE_VERSION
public static final int FQQN_CHANGE_VERSION
- See Also:
- Constant Field Values
-
ARTEMIS_2_18_0_VERSION
public static final int ARTEMIS_2_18_0_VERSION
- See Also:
- Constant Field Values
-
ARTEMIS_2_21_0_VERSION
public static final int ARTEMIS_2_21_0_VERSION
- See Also:
- Constant Field Values
-
OLD_QUEUE_PREFIX
public static final SimpleString OLD_QUEUE_PREFIX
-
OLD_TEMP_QUEUE_PREFIX
public static final SimpleString OLD_TEMP_QUEUE_PREFIX
-
OLD_TOPIC_PREFIX
public static final SimpleString OLD_TOPIC_PREFIX
-
OLD_TEMP_TOPIC_PREFIX
public static final SimpleString OLD_TEMP_TOPIC_PREFIX
-
PACKET_HEADERS_SIZE
public static final int PACKET_HEADERS_SIZE
- See Also:
- Constant Field Values
-
channelID
protected long channelID
-
size
protected int size
-
PING
public static final byte PING
- See Also:
- Constant Field Values
-
DISCONNECT
public static final byte DISCONNECT
- See Also:
- Constant Field Values
-
DISCONNECT_CONSUMER
public static final byte DISCONNECT_CONSUMER
- See Also:
- Constant Field Values
-
DISCONNECT_CONSUMER_KILL
public static final byte DISCONNECT_CONSUMER_KILL
- See Also:
- Constant Field Values
-
EXCEPTION
public static final byte EXCEPTION
- See Also:
- Constant Field Values
-
NULL_RESPONSE
public static final byte NULL_RESPONSE
- See Also:
- Constant Field Values
-
PACKETS_CONFIRMED
public static final byte PACKETS_CONFIRMED
- See Also:
- Constant Field Values
-
CREATESESSION
public static final byte CREATESESSION
- See Also:
- Constant Field Values
-
CREATESESSION_RESP
public static final byte CREATESESSION_RESP
- See Also:
- Constant Field Values
-
REATTACH_SESSION
public static final byte REATTACH_SESSION
- See Also:
- Constant Field Values
-
REATTACH_SESSION_RESP
public static final byte REATTACH_SESSION_RESP
- See Also:
- Constant Field Values
-
CREATE_QUEUE
public static final byte CREATE_QUEUE
- See Also:
- Constant Field Values
-
DELETE_QUEUE
public static final byte DELETE_QUEUE
- See Also:
- Constant Field Values
-
CREATE_SHARED_QUEUE
public static final byte CREATE_SHARED_QUEUE
- See Also:
- Constant Field Values
-
SESS_XA_FAILED
public static final byte SESS_XA_FAILED
- See Also:
- Constant Field Values
-
SESS_CREATECONSUMER
public static final byte SESS_CREATECONSUMER
- See Also:
- Constant Field Values
-
SESS_ACKNOWLEDGE
public static final byte SESS_ACKNOWLEDGE
- See Also:
- Constant Field Values
-
SESS_EXPIRED
public static final byte SESS_EXPIRED
- See Also:
- Constant Field Values
-
SESS_COMMIT
public static final byte SESS_COMMIT
- See Also:
- Constant Field Values
-
SESS_ROLLBACK
public static final byte SESS_ROLLBACK
- See Also:
- Constant Field Values
-
SESS_QUEUEQUERY
public static final byte SESS_QUEUEQUERY
- See Also:
- Constant Field Values
-
SESS_QUEUEQUERY_RESP
public static final byte SESS_QUEUEQUERY_RESP
- See Also:
- Constant Field Values
-
SESS_BINDINGQUERY
public static final byte SESS_BINDINGQUERY
- See Also:
- Constant Field Values
-
SESS_BINDINGQUERY_RESP
public static final byte SESS_BINDINGQUERY_RESP
- See Also:
- Constant Field Values
-
SESS_XA_START
public static final byte SESS_XA_START
- See Also:
- Constant Field Values
-
SESS_XA_END
public static final byte SESS_XA_END
- See Also:
- Constant Field Values
-
SESS_XA_COMMIT
public static final byte SESS_XA_COMMIT
- See Also:
- Constant Field Values
-
SESS_XA_PREPARE
public static final byte SESS_XA_PREPARE
- See Also:
- Constant Field Values
-
SESS_XA_RESP
public static final byte SESS_XA_RESP
- See Also:
- Constant Field Values
-
SESS_XA_ROLLBACK
public static final byte SESS_XA_ROLLBACK
- See Also:
- Constant Field Values
-
SESS_XA_JOIN
public static final byte SESS_XA_JOIN
- See Also:
- Constant Field Values
-
SESS_XA_SUSPEND
public static final byte SESS_XA_SUSPEND
- See Also:
- Constant Field Values
-
SESS_XA_RESUME
public static final byte SESS_XA_RESUME
- See Also:
- Constant Field Values
-
SESS_XA_FORGET
public static final byte SESS_XA_FORGET
- See Also:
- Constant Field Values
-
SESS_XA_INDOUBT_XIDS
public static final byte SESS_XA_INDOUBT_XIDS
- See Also:
- Constant Field Values
-
SESS_XA_INDOUBT_XIDS_RESP
public static final byte SESS_XA_INDOUBT_XIDS_RESP
- See Also:
- Constant Field Values
-
SESS_XA_SET_TIMEOUT
public static final byte SESS_XA_SET_TIMEOUT
- See Also:
- Constant Field Values
-
SESS_XA_SET_TIMEOUT_RESP
public static final byte SESS_XA_SET_TIMEOUT_RESP
- See Also:
- Constant Field Values
-
SESS_XA_GET_TIMEOUT
public static final byte SESS_XA_GET_TIMEOUT
- See Also:
- Constant Field Values
-
SESS_XA_GET_TIMEOUT_RESP
public static final byte SESS_XA_GET_TIMEOUT_RESP
- See Also:
- Constant Field Values
-
SESS_START
public static final byte SESS_START
- See Also:
- Constant Field Values
-
SESS_STOP
public static final byte SESS_STOP
- See Also:
- Constant Field Values
-
SESS_CLOSE
public static final byte SESS_CLOSE
- See Also:
- Constant Field Values
-
SESS_FLOWTOKEN
public static final byte SESS_FLOWTOKEN
- See Also:
- Constant Field Values
-
SESS_SEND
public static final byte SESS_SEND
- See Also:
- Constant Field Values
-
SESS_SEND_LARGE
public static final byte SESS_SEND_LARGE
- See Also:
- Constant Field Values
-
SESS_SEND_CONTINUATION
public static final byte SESS_SEND_CONTINUATION
- See Also:
- Constant Field Values
-
SESS_CONSUMER_CLOSE
public static final byte SESS_CONSUMER_CLOSE
- See Also:
- Constant Field Values
-
SESS_RECEIVE_MSG
public static final byte SESS_RECEIVE_MSG
- See Also:
- Constant Field Values
-
SESS_RECEIVE_LARGE_MSG
public static final byte SESS_RECEIVE_LARGE_MSG
- See Also:
- Constant Field Values
-
SESS_RECEIVE_CONTINUATION
public static final byte SESS_RECEIVE_CONTINUATION
- See Also:
- Constant Field Values
-
SESS_FORCE_CONSUMER_DELIVERY
public static final byte SESS_FORCE_CONSUMER_DELIVERY
- See Also:
- Constant Field Values
-
SESS_PRODUCER_REQUEST_CREDITS
public static final byte SESS_PRODUCER_REQUEST_CREDITS
- See Also:
- Constant Field Values
-
SESS_PRODUCER_CREDITS
public static final byte SESS_PRODUCER_CREDITS
- See Also:
- Constant Field Values
-
SESS_INDIVIDUAL_ACKNOWLEDGE
public static final byte SESS_INDIVIDUAL_ACKNOWLEDGE
- See Also:
- Constant Field Values
-
SESS_PRODUCER_FAIL_CREDITS
public static final byte SESS_PRODUCER_FAIL_CREDITS
- See Also:
- Constant Field Values
-
REPLICATION_RESPONSE
public static final byte REPLICATION_RESPONSE
- See Also:
- Constant Field Values
-
REPLICATION_APPEND
public static final byte REPLICATION_APPEND
- See Also:
- Constant Field Values
-
REPLICATION_APPEND_TX
public static final byte REPLICATION_APPEND_TX
- See Also:
- Constant Field Values
-
REPLICATION_DELETE
public static final byte REPLICATION_DELETE
- See Also:
- Constant Field Values
-
REPLICATION_DELETE_TX
public static final byte REPLICATION_DELETE_TX
- See Also:
- Constant Field Values
-
REPLICATION_PREPARE
public static final byte REPLICATION_PREPARE
- See Also:
- Constant Field Values
-
REPLICATION_COMMIT_ROLLBACK
public static final byte REPLICATION_COMMIT_ROLLBACK
- See Also:
- Constant Field Values
-
REPLICATION_PAGE_WRITE
public static final byte REPLICATION_PAGE_WRITE
- See Also:
- Constant Field Values
-
REPLICATION_PAGE_EVENT
public static final byte REPLICATION_PAGE_EVENT
- See Also:
- Constant Field Values
-
REPLICATION_LARGE_MESSAGE_BEGIN
public static final byte REPLICATION_LARGE_MESSAGE_BEGIN
- See Also:
- Constant Field Values
-
REPLICATION_LARGE_MESSAGE_END
public static final byte REPLICATION_LARGE_MESSAGE_END
- See Also:
- Constant Field Values
-
REPLICATION_LARGE_MESSAGE_WRITE
public static final byte REPLICATION_LARGE_MESSAGE_WRITE
- See Also:
- Constant Field Values
-
REPLICATION_SYNC_FILE
public static final byte REPLICATION_SYNC_FILE
- See Also:
- Constant Field Values
-
SESS_ADD_METADATA
public static final byte SESS_ADD_METADATA
- See Also:
- Constant Field Values
-
SESS_ADD_METADATA2
public static final byte SESS_ADD_METADATA2
- See Also:
- Constant Field Values
-
SESS_UNIQUE_ADD_METADATA
public static final byte SESS_UNIQUE_ADD_METADATA
- See Also:
- Constant Field Values
-
CLUSTER_TOPOLOGY
public static final byte CLUSTER_TOPOLOGY
- See Also:
- Constant Field Values
-
NODE_ANNOUNCE
public static final byte NODE_ANNOUNCE
- See Also:
- Constant Field Values
-
SUBSCRIBE_TOPOLOGY
public static final byte SUBSCRIBE_TOPOLOGY
- See Also:
- Constant Field Values
-
SUBSCRIBE_TOPOLOGY_V2
public static final byte SUBSCRIBE_TOPOLOGY_V2
- See Also:
- Constant Field Values
-
CLUSTER_TOPOLOGY_V2
public static final byte CLUSTER_TOPOLOGY_V2
- See Also:
- Constant Field Values
-
BACKUP_REGISTRATION
public static final byte BACKUP_REGISTRATION
- See Also:
- Constant Field Values
-
BACKUP_REGISTRATION_FAILED
public static final byte BACKUP_REGISTRATION_FAILED
- See Also:
- Constant Field Values
-
REPLICATION_START_FINISH_SYNC
public static final byte REPLICATION_START_FINISH_SYNC
- See Also:
- Constant Field Values
-
REPLICATION_SCHEDULED_FAILOVER
public static final byte REPLICATION_SCHEDULED_FAILOVER
- See Also:
- Constant Field Values
-
CLUSTER_TOPOLOGY_V3
public static final byte CLUSTER_TOPOLOGY_V3
- See Also:
- Constant Field Values
-
DISCONNECT_V2
public static final byte DISCONNECT_V2
- See Also:
- Constant Field Values
-
CLUSTER_CONNECT
public static final byte CLUSTER_CONNECT
- See Also:
- Constant Field Values
-
CLUSTER_CONNECT_REPLY
public static final byte CLUSTER_CONNECT_REPLY
- See Also:
- Constant Field Values
-
BACKUP_REQUEST
public static final byte BACKUP_REQUEST
- See Also:
- Constant Field Values
-
BACKUP_REQUEST_RESPONSE
public static final byte BACKUP_REQUEST_RESPONSE
- See Also:
- Constant Field Values
-
QUORUM_VOTE
public static final byte QUORUM_VOTE
- See Also:
- Constant Field Values
-
QUORUM_VOTE_REPLY
public static final byte QUORUM_VOTE_REPLY
- See Also:
- Constant Field Values
-
CHECK_FOR_FAILOVER
public static final byte CHECK_FOR_FAILOVER
- See Also:
- Constant Field Values
-
CHECK_FOR_FAILOVER_REPLY
public static final byte CHECK_FOR_FAILOVER_REPLY
- See Also:
- Constant Field Values
-
SCALEDOWN_ANNOUNCEMENT
public static final byte SCALEDOWN_ANNOUNCEMENT
- See Also:
- Constant Field Values
-
SESS_QUEUEQUERY_RESP_V2
public static final byte SESS_QUEUEQUERY_RESP_V2
- See Also:
- Constant Field Values
-
SESS_BINDINGQUERY_RESP_V2
public static final byte SESS_BINDINGQUERY_RESP_V2
- See Also:
- Constant Field Values
-
REPLICATION_RESPONSE_V2
public static final byte REPLICATION_RESPONSE_V2
- See Also:
- Constant Field Values
-
SESS_BINDINGQUERY_RESP_V3
public static final byte SESS_BINDINGQUERY_RESP_V3
- See Also:
- Constant Field Values
-
CREATE_ADDRESS
public static final byte CREATE_ADDRESS
- See Also:
- Constant Field Values
-
CREATE_QUEUE_V2
public static final byte CREATE_QUEUE_V2
- See Also:
- Constant Field Values
-
CREATE_SHARED_QUEUE_V2
public static final byte CREATE_SHARED_QUEUE_V2
- See Also:
- Constant Field Values
-
SESS_QUEUEQUERY_RESP_V3
public static final byte SESS_QUEUEQUERY_RESP_V3
- See Also:
- Constant Field Values
-
SESS_BINDINGQUERY_RESP_V4
public static final byte SESS_BINDINGQUERY_RESP_V4
- See Also:
- Constant Field Values
-
FEDERATION_DOWNSTREAM_CONNECT
public static final byte FEDERATION_DOWNSTREAM_CONNECT
- See Also:
- Constant Field Values
-
CLUSTER_TOPOLOGY_V4
public static final byte CLUSTER_TOPOLOGY_V4
- See Also:
- Constant Field Values
-
CREATESESSION_V2
public static final byte CREATESESSION_V2
- See Also:
- Constant Field Values
-
DISCONNECT_V3
public static final byte DISCONNECT_V3
- See Also:
- Constant Field Values
-
-
Method Detail
-
convertName
public SimpleString convertName(SimpleString name)
-
getType
public byte getType()
Description copied from interface:Packetreturns the type of the packet.This is needed when decoding the packet
-
getChannelID
public long getChannelID()
Description copied from interface:PacketReturns the channel id of the channel that should handle this packet.- Specified by:
getChannelIDin interfacePacket- Returns:
- the id of the channel
-
setChannelID
public void setChannelID(long channelID)
Description copied from interface:PacketSets the channel id that should be used once the packet has been successfully decoded it is sent to the correct channel.- Specified by:
setChannelIDin interfacePacket- Parameters:
channelID- the id of the channel to handle the packet
-
encode
public ActiveMQBuffer encode(CoreRemotingConnection connection)
Description copied from interface:PacketEncodes the packet and returns aActiveMQBuffercontaining the data
-
encodeHeader
protected void encodeHeader(ActiveMQBuffer buffer)
-
encodeSize
protected void encodeSize(ActiveMQBuffer buffer)
-
createPacket
protected ActiveMQBuffer createPacket(CoreRemotingConnection connection)
-
decode
public void decode(ActiveMQBuffer buffer)
Description copied from interface:Packetdecodes the buffer into this packet
-
copyMessageBuffer
protected static io.netty.buffer.ByteBuf copyMessageBuffer(io.netty.buffer.ByteBuf buffer, int skipBytes)
-
getPacketSize
public int getPacketSize()
Description copied from interface:Packetreturns the size needed to encode this packet.- Specified by:
getPacketSizein interfacePacket- Returns:
- The size of the entire packet including headers, and extra data
-
isResponse
public boolean isResponse()
Description copied from interface:Packetreturns true if this packet is being sent in response to a previously received packet- Specified by:
isResponsein interfacePacket- Returns:
- true if a response
-
encodeRest
public void encodeRest(ActiveMQBuffer buffer)
-
encodeRest
public void encodeRest(ActiveMQBuffer buffer, CoreRemotingConnection coreRemotingConnection)
-
decodeRest
public void decodeRest(ActiveMQBuffer buffer)
-
isRequiresConfirmations
public boolean isRequiresConfirmations()
Description copied from interface:Packetreturns true if a confirmation should be sent on receipt of this packet.- Specified by:
isRequiresConfirmationsin interfacePacket- Returns:
- true if confirmation is required
-
toString
public final String toString()
extensions of this class are supposed to use getPacketString to provide toString functionality
-
getPacketString
protected String getPacketString()
-
nullableStringEncodeSize
protected int nullableStringEncodeSize(String str)
-
isRequiresResponse
public boolean isRequiresResponse()
- Specified by:
isRequiresResponsein interfacePacket
-
isResponseAsync
public boolean isResponseAsync()
- Specified by:
isResponseAsyncin interfacePacket
-
getCorrelationID
public long getCorrelationID()
- Specified by:
getCorrelationIDin interfacePacket
-
setCorrelationID
public void setCorrelationID(long correlationID)
- Specified by:
setCorrelationIDin interfacePacket
-
-