Package org.apache.pulsar.common.api.raw
Interface RawMessage
- All Known Implementing Classes:
RawMessageImpl
public interface RawMessage
View of a message that exposes the internal direct-memory buffer for more efficient processing.
The message needs to be released when the processing is done.
-
Method Summary
Modifier and TypeMethodDescriptionint
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 version 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.
-
Method Details
-
release
void release()Release all the resources associated with this raw message. -
getProperties
Return the properties attached to the message.Properties are application defined key/value pairs that will be attached to the message.
- Returns:
- an unmodifiable view of the properties map
-
getData
io.netty.buffer.ByteBuf getData()Get the content of the message.- Returns:
- the byte array with the message payload
-
getMessageId
RawMessageId getMessageId()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.
- Returns:
- the message id null if this message was not received by this client instance
-
getPublishTime
long getPublishTime()Get the publish time of this message. The publish time is the timestamp that a client publish the message.- Returns:
- publish time of this message.
- See Also:
-
getEventTime
long getEventTime()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.
-
getSequenceId
long getSequenceId()Get the sequence id associated with this message. It is typically set by the applications viaMessageBuilder#setSequenceId(long)
.- Returns:
- sequence id associated with this message.
- See Also:
-
MessageBuilder#setEventTime(long)
-
getProducerName
String getProducerName()Get the producer name who produced this message.- Returns:
- producer name who produced this message, null if producer name is not set.
-
getKey
Get the key of the message.- Returns:
- the key of the message
-
getSchemaVersion
byte[] getSchemaVersion()Get the schema version of the message.- Returns:
- the schema version of the message
-
getKeyBytes
Optional<io.netty.buffer.ByteBuf> getKeyBytes()Get byteBuf of the key.- Returns:
- the byte array with the key payload
-
hasBase64EncodedKey
boolean hasBase64EncodedKey()Check whether the key has been base64 encoded.- Returns:
- true if the key is base64 encoded, false otherwise
-
getUUID
String getUUID()Get uuid of chunked message.- Returns:
- uuid
-
getChunkId
int getChunkId()Get chunkId of chunked message.- Returns:
- chunkId
-
getNumChunksFromMsg
int getNumChunksFromMsg()Get chunk num of chunked message.- Returns:
- chunk num
-
getTotalChunkMsgSize
int getTotalChunkMsgSize()Get chunk message total size in bytes.- Returns:
- chunked message total size in bytes
-