Package org.apache.pulsar.client.api.v5
Interface MessageId
- All Superinterfaces:
Comparable<MessageId>
Opaque, immutable identifier for a message within a topic.
No internal structure (ledger ID, entry ID, partition index) is exposed. Message IDs can be serialized to bytes for external storage and restored later.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageIdearliest()Sentinel representing the oldest available message in the topic.static MessageIdfromByteArray(byte[] data) Deserialize a message ID from bytes previously produced bytoByteArray().static MessageIdlatest()Sentinel representing the next message to be published (i.e., the end of the topic).byte[]Serialize this message ID to a byte array for external storage.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
toByteArray
byte[] toByteArray()Serialize this message ID to a byte array for external storage.- Returns:
- a byte array representation of this message ID that can be restored
via
fromByteArray(byte[])
-
fromByteArray
Deserialize a message ID from bytes previously produced bytoByteArray().- Parameters:
data- the byte array previously obtained fromtoByteArray()- Returns:
- the deserialized
MessageId - Throws:
IOException- if the byte array is malformed or cannot be deserialized
-
earliest
Sentinel representing the oldest available message in the topic.- Returns:
- a sentinel
MessageIdrepresenting the earliest position in the topic
-
latest
Sentinel representing the next message to be published (i.e., the end of the topic).- Returns:
- a sentinel
MessageIdrepresenting the latest position in the topic
-