Class RawMessageImpl

java.lang.Object
org.apache.pulsar.common.api.raw.RawMessageImpl
All Implemented Interfaces:
RawMessage

public class RawMessageImpl extends Object implements RawMessage
  • Method Details

    • release

      public void release()
      Description copied from interface: RawMessage
      Release all the resources associated with this raw message.
      Specified by:
      release in interface RawMessage
    • get

      public static RawMessage get(ReferenceCountedMessageMetadata msgMetadata, SingleMessageMetadata singleMessageMetadata, io.netty.buffer.ByteBuf payload, long ledgerId, long entryId, long batchIndex)
    • updatePayloadForChunkedMessage

      public RawMessage updatePayloadForChunkedMessage(io.netty.buffer.ByteBuf chunkedTotalPayload)
    • getProperties

      public Map<String,String> getProperties()
      Description copied from interface: RawMessage
      Return the properties attached to the message.

      Properties are application defined key/value pairs that will be attached to the message.

      Specified by:
      getProperties in interface RawMessage
      Returns:
      an unmodifiable view of the properties map
    • getData

      public io.netty.buffer.ByteBuf getData()
      Description copied from interface: RawMessage
      Get the content of the message.
      Specified by:
      getData in interface RawMessage
      Returns:
      the byte array with the message payload
    • getMessageId

      public RawMessageId getMessageId()
      Description copied from interface: RawMessage
      Get the unique message ID associated with this message.

      The message id can be used to univocally refer to a message without having the keep the entire payload in memory.

      Only messages received from the consumer will have a message id assigned.

      Specified by:
      getMessageId in interface RawMessage
      Returns:
      the message id null if this message was not received by this client instance
    • getPublishTime

      public long getPublishTime()
      Description copied from interface: RawMessage
      Get the publish time of this message. The publish time is the timestamp that a client publish the message.
      Specified by:
      getPublishTime in interface RawMessage
      Returns:
      publish time of this message.
      See Also:
    • getEventTime

      public long getEventTime()
      Description copied from interface: RawMessage
      Get the event time associated with this message. It is typically set by the applications via MessageBuilder#setEventTime(long).

      If there isn't any event time associated with this event, it will return 0.

      Specified by:
      getEventTime in interface RawMessage
    • getSequenceId

      public long getSequenceId()
      Description copied from interface: RawMessage
      Get the sequence id associated with this message. It is typically set by the applications via MessageBuilder#setSequenceId(long).
      Specified by:
      getSequenceId in interface RawMessage
      Returns:
      sequence id associated with this message.
      See Also:
      • MessageBuilder#setEventTime(long)
    • getProducerName

      public String getProducerName()
      Description copied from interface: RawMessage
      Get the producer name who produced this message.
      Specified by:
      getProducerName in interface RawMessage
      Returns:
      producer name who produced this message, null if producer name is not set.
    • getKey

      public Optional<String> getKey()
      Description copied from interface: RawMessage
      Get the key of the message.
      Specified by:
      getKey in interface RawMessage
      Returns:
      the key of the message
    • getSchemaVersion

      public byte[] getSchemaVersion()
      Description copied from interface: RawMessage
      Get the schema verison of the message.
      Specified by:
      getSchemaVersion in interface RawMessage
      Returns:
      the schema version of the message
    • getKeyBytes

      public Optional<io.netty.buffer.ByteBuf> getKeyBytes()
      Description copied from interface: RawMessage
      Get byteBuf of the key.
      Specified by:
      getKeyBytes in interface RawMessage
      Returns:
      the byte array with the key payload
    • hasBase64EncodedKey

      public boolean hasBase64EncodedKey()
      Description copied from interface: RawMessage
      Check whether the key has been base64 encoded.
      Specified by:
      hasBase64EncodedKey in interface RawMessage
      Returns:
      true if the key is base64 encoded, false otherwise
    • getUUID

      public String getUUID()
      Description copied from interface: RawMessage
      Get uuid of chunked message.
      Specified by:
      getUUID in interface RawMessage
      Returns:
      uuid
    • getChunkId

      public int getChunkId()
      Description copied from interface: RawMessage
      Get chunkId of chunked message.
      Specified by:
      getChunkId in interface RawMessage
      Returns:
      chunkId
    • getNumChunksFromMsg

      public int getNumChunksFromMsg()
      Description copied from interface: RawMessage
      Get chunk num of chunked message.
      Specified by:
      getNumChunksFromMsg in interface RawMessage
      Returns:
      chunk num
    • getTotalChunkMsgSize

      public int getTotalChunkMsgSize()
      Description copied from interface: RawMessage
      Get chunk message total size in bytes.
      Specified by:
      getTotalChunkMsgSize in interface RawMessage
      Returns:
      chunked message total size in bytes
    • getBatchSize

      public int getBatchSize()