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, CreateProducerMessage, CreateQueueMessage, CreateSessionMessage, CreateSessionResponseMessage, CreateSharedQueueMessage, DisconnectConsumerMessage, DisconnectConsumerWithKillMessage, DisconnectMessage, FederationStreamConnectMessage, MessagePacket, NodeAnnounceMessage, NullResponseMessage, PacketsConfirmedMessage, Ping, QueueAbstractPacket, QuorumVoteMessage, QuorumVoteReplyMessage, ReattachSessionMessage, ReattachSessionResponseMessage, RemoveProducerMessage, ReplicationAddMessage, ReplicationAddTXMessage, ReplicationCommitMessage, ReplicationDeleteMessage, ReplicationDeleteTXMessage, ReplicationLargeMessageBeginMessage, ReplicationLargeMessageEndMessage, ReplicationLargeMessageWriteMessage, ReplicationPageEventMessage, ReplicationPageWriteMessage, ReplicationPrepareMessage, ReplicationPrimaryIsStoppingMessage, 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 Details

  • Constructor Details

    • PacketImpl

      public PacketImpl(byte type)
  • Method Details

    • convertName

      public SimpleString convertName(SimpleString name)
    • getType

      public byte getType()
      Description copied from interface: Packet
      Returns the type of the packet; needed when decoding the packet.
      Specified by:
      getType in interface Packet
      Returns:
      the type of the packet; needed when decoding the packet
    • getChannelID

      public long getChannelID()
      Description copied from interface: Packet
      Returns the channel id of the channel that should handle this packet.
      Specified by:
      getChannelID in interface Packet
      Returns:
      the channel id of the channel that should handle this packet
    • setChannelID

      public void setChannelID(long channelID)
      Description copied from interface: Packet
      Sets the channel id that should be used once the packet has been successfully decoded it is sent to the correct channel.
      Specified by:
      setChannelID in interface Packet
      Parameters:
      channelID - the id of the channel to handle the packet
    • encode

      public ActiveMQBuffer encode(CoreRemotingConnection connection)
      Description copied from interface: Packet
      Encodes the packet and returns a ActiveMQBuffer containing the data
      Specified by:
      encode in interface Packet
      Parameters:
      connection - the connection
      Returns:
      the buffer to encode to
    • 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: Packet
      decodes the buffer into this packet
      Specified by:
      decode in interface Packet
      Parameters:
      buffer - the buffer to decode from
    • copyMessageBuffer

      protected static io.netty.buffer.ByteBuf copyMessageBuffer(io.netty.buffer.ByteBuf buffer, int skipBytes)
    • getPacketSize

      public int getPacketSize()
      Description copied from interface: Packet
      Returns The size of the entire packet including headers, and extra data; i.e. the size needed to encode this packet.
      Specified by:
      getPacketSize in interface Packet
      Returns:
      The size of the entire packet including headers, and extra data; i.e. the size needed to encode this packet
    • isResponse

      public boolean isResponse()
      Description copied from interface: Packet
      Returns true if this packet is being sent in response to a previously received packet.
      Specified by:
      isResponse in interface Packet
      Returns:
      true if this packet is being sent in response to a previously received packet
    • 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: Packet
      Returns true if a confirmation should be sent on receipt of this packet.
      Specified by:
      isRequiresConfirmations in interface Packet
      Returns:
      true if a confirmation should be sent on receipt of this packet
    • toString

      public final String toString()
      extensions of this class are supposed to use getPacketString to provide toString functionality
      Overrides:
      toString in class Object
    • getPacketString

      protected String getPacketString()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • nullableStringEncodeSize

      protected int nullableStringEncodeSize(String str)
    • isRequiresResponse

      public boolean isRequiresResponse()
      Specified by:
      isRequiresResponse in interface Packet
    • isResponseAsync

      public boolean isResponseAsync()
      Specified by:
      isResponseAsync in interface Packet
    • getCorrelationID

      public long getCorrelationID()
      Specified by:
      getCorrelationID in interface Packet
    • setCorrelationID

      public void setCorrelationID(long correlationID)
      Specified by:
      setCorrelationID in interface Packet