Package org.apache.pulsar.common.api.raw
Class RawMessageImpl
java.lang.Object
org.apache.pulsar.common.api.raw.RawMessageImpl
- All Implemented Interfaces:
RawMessage
-
Method Summary
Modifier and TypeMethodDescriptionstatic RawMessageget(ReferenceCountedMessageMetadata msgMetadata, SingleMessageMetadata singleMessageMetadata, io.netty.buffer.ByteBuf payload, long ledgerId, long entryId, long batchIndex) intintGet chunkId of chunked message.io.netty.buffer.ByteBufgetData()Get the content of the message.longGet the event time associated with this message.getKey()Get the key of the message.Optional<io.netty.buffer.ByteBuf> Get byteBuf of the key.Get the unique message ID associated with this message.intGet chunk num of chunked message.Get the producer name who produced this message.Return the properties attached to the message.longGet the publish time of this message.byte[]Get the schema version of the message.longGet the sequence id associated with this message.intGet chunk message total size in bytes.getUUID()Get uuid of chunked message.booleanCheck whether the key has been base64 encoded.voidrelease()Release all the resources associated with this raw message.updatePayloadForChunkedMessage(io.netty.buffer.ByteBuf chunkedTotalPayload)
-
Method Details
-
release
public void release()Description copied from interface:RawMessageRelease all the resources associated with this raw message.- Specified by:
releasein interfaceRawMessage
-
get
public static RawMessage get(ReferenceCountedMessageMetadata msgMetadata, SingleMessageMetadata singleMessageMetadata, io.netty.buffer.ByteBuf payload, long ledgerId, long entryId, long batchIndex) -
updatePayloadForChunkedMessage
-
getProperties
Description copied from interface:RawMessageReturn the properties attached to the message.Properties are application defined key/value pairs that will be attached to the message.
- Specified by:
getPropertiesin interfaceRawMessage- Returns:
- an unmodifiable view of the properties map
-
getData
public io.netty.buffer.ByteBuf getData()Description copied from interface:RawMessageGet the content of the message.- Specified by:
getDatain interfaceRawMessage- Returns:
- the byte array with the message payload
-
getMessageId
Description copied from interface:RawMessageGet 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:
getMessageIdin interfaceRawMessage- Returns:
- the message id null if this message was not received by this client instance
-
getPublishTime
public long getPublishTime()Description copied from interface:RawMessageGet the publish time of this message. The publish time is the timestamp that a client publish the message.- Specified by:
getPublishTimein interfaceRawMessage- Returns:
- publish time of this message.
- See Also:
-
getEventTime
public long getEventTime()Description copied from interface:RawMessageGet the event time associated with this message. It is typically set by the applications via.invalid reference
MessageBuilder#setEventTime(long)If there isn't any event time associated with this event, it will return 0.
- Specified by:
getEventTimein interfaceRawMessage
-
getSequenceId
public long getSequenceId()Description copied from interface:RawMessageGet the sequence id associated with this message. It is typically set by the applications via.invalid reference
MessageBuilder#setSequenceId(long)- Specified by:
getSequenceIdin interfaceRawMessage- Returns:
- sequence id associated with this message.
- See Also:
-
getProducerName
Description copied from interface:RawMessageGet the producer name who produced this message.- Specified by:
getProducerNamein interfaceRawMessage- Returns:
- producer name who produced this message, null if producer name is not set.
-
getKey
Description copied from interface:RawMessageGet the key of the message.- Specified by:
getKeyin interfaceRawMessage- Returns:
- the key of the message
-
getSchemaVersion
public byte[] getSchemaVersion()Description copied from interface:RawMessageGet the schema version of the message.- Specified by:
getSchemaVersionin interfaceRawMessage- Returns:
- the schema version of the message
-
getKeyBytes
Description copied from interface:RawMessageGet byteBuf of the key.- Specified by:
getKeyBytesin interfaceRawMessage- Returns:
- the byte array with the key payload
-
hasBase64EncodedKey
public boolean hasBase64EncodedKey()Description copied from interface:RawMessageCheck whether the key has been base64 encoded.- Specified by:
hasBase64EncodedKeyin interfaceRawMessage- Returns:
- true if the key is base64 encoded, false otherwise
-
getUUID
Description copied from interface:RawMessageGet uuid of chunked message.- Specified by:
getUUIDin interfaceRawMessage- Returns:
- uuid
-
getChunkId
public int getChunkId()Description copied from interface:RawMessageGet chunkId of chunked message.- Specified by:
getChunkIdin interfaceRawMessage- Returns:
- chunkId
-
getNumChunksFromMsg
public int getNumChunksFromMsg()Description copied from interface:RawMessageGet chunk num of chunked message.- Specified by:
getNumChunksFromMsgin interfaceRawMessage- Returns:
- chunk num
-
getTotalChunkMsgSize
public int getTotalChunkMsgSize()Description copied from interface:RawMessageGet chunk message total size in bytes.- Specified by:
getTotalChunkMsgSizein interfaceRawMessage- Returns:
- chunked message total size in bytes
-
getBatchSize
public int getBatchSize()
-