接口 MessageId
-
- 所有超级接口:
java.lang.Comparable<MessageId>,java.io.Serializable
@Public @Stable public interface MessageId extends java.lang.Comparable<MessageId>, java.io.Serializable
Opaque unique identifier of a single messageThe MessageId can be used to reference a specific message, for example when acknowledging, without having to retain the message content in memory for an extended period of time.
Message ids are
Comparableand a bigger message id will imply that a message was published "after" the other one.
-
-
方法概要
所有方法 静态方法 实例方法 抽象方法 修饰符和类型 方法 说明 static MessageIdfromByteArray(byte[] data)De-serialize a message id from a byte array.static MessageIdfromByteArrayWithTopic(byte[] data, java.lang.String topicName)De-serialize a message id from a byte array with its topic information attached.byte[]toByteArray()Serialize the message ID into a byte array.
-
-
-
方法详细资料
-
toByteArray
byte[] toByteArray()
Serialize the message ID into a byte array.The serialized message id can be stored away and later get deserialized by using
fromByteArray(byte[]).
-
fromByteArray
static MessageId fromByteArray(byte[] data) throws java.io.IOException
De-serialize a message id from a byte array.- 参数:
data- byte array containing the serialized message id- 返回:
- the de-serialized messageId object
- 抛出:
java.io.IOException- if the de-serialization fails
-
fromByteArrayWithTopic
static MessageId fromByteArrayWithTopic(byte[] data, java.lang.String topicName) throws java.io.IOException
De-serialize a message id from a byte array with its topic information attached.The topic information is needed when acknowledging a
MessageIdon a consumer that is consuming from multiple topics.- 参数:
data- the byte array with the serialized message idtopicName- the topic name- 返回:
- a
instance - 抛出:
java.io.IOException- if the de-serialization fails
-
-