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 RawMessage
get
(ReferenceCountedMessageMetadata msgMetadata, SingleMessageMetadata singleMessageMetadata, io.netty.buffer.ByteBuf payload, long ledgerId, long entryId, long batchIndex) int
int
Get chunkId of chunked message.io.netty.buffer.ByteBuf
getData()
Get the content of the message.long
Get 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.int
Get chunk num of chunked message.Get the producer name who produced this message.Return the properties attached to the message.long
Get the publish time of this message.byte[]
Get the schema verison of the message.long
Get the sequence id associated with this message.int
Get chunk message total size in bytes.getUUID()
Get uuid of chunked message.boolean
Check whether the key has been base64 encoded.void
release()
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:RawMessage
Release all the resources associated with this raw message.- Specified by:
release
in 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: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 interfaceRawMessage
- 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 interfaceRawMessage
- Returns:
- the byte array with the message payload
-
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 interfaceRawMessage
- 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 interfaceRawMessage
- 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 viaMessageBuilder#setEventTime(long)
.If there isn't any event time associated with this event, it will return 0.
- Specified by:
getEventTime
in interfaceRawMessage
-
getSequenceId
public long getSequenceId()Description copied from interface:RawMessage
Get the sequence id associated with this message. It is typically set by the applications viaMessageBuilder#setSequenceId(long)
.- Specified by:
getSequenceId
in interfaceRawMessage
- Returns:
- sequence id associated with this message.
- See Also:
-
MessageBuilder#setEventTime(long)
-
getProducerName
Description copied from interface:RawMessage
Get the producer name who produced this message.- Specified by:
getProducerName
in interfaceRawMessage
- Returns:
- producer name who produced this message, null if producer name is not set.
-
getKey
Description copied from interface:RawMessage
Get the key of the message.- Specified by:
getKey
in interfaceRawMessage
- 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 interfaceRawMessage
- Returns:
- the schema version of the message
-
getKeyBytes
Description copied from interface:RawMessage
Get byteBuf of the key.- Specified by:
getKeyBytes
in interfaceRawMessage
- 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 interfaceRawMessage
- Returns:
- true if the key is base64 encoded, false otherwise
-
getUUID
Description copied from interface:RawMessage
Get uuid of chunked message.- Specified by:
getUUID
in interfaceRawMessage
- Returns:
- uuid
-
getChunkId
public int getChunkId()Description copied from interface:RawMessage
Get chunkId of chunked message.- Specified by:
getChunkId
in interfaceRawMessage
- Returns:
- chunkId
-
getNumChunksFromMsg
public int getNumChunksFromMsg()Description copied from interface:RawMessage
Get chunk num of chunked message.- Specified by:
getNumChunksFromMsg
in interfaceRawMessage
- Returns:
- chunk num
-
getTotalChunkMsgSize
public int getTotalChunkMsgSize()Description copied from interface:RawMessage
Get chunk message total size in bytes.- Specified by:
getTotalChunkMsgSize
in interfaceRawMessage
- Returns:
- chunked message total size in bytes
-
getBatchSize
public int getBatchSize()
-