public abstract class MessageMetadata
Information about a message in Pub/Sub Lite. Can be encoded in the string returned by the Cloud Pub/Sub com.google.cloud.pubsub.v1.Publisher#publish api or the com.google.pubsub.v1.PubsubMessage#getMessageId field on received messages.
Static Methods
decode(String encoded)
public static MessageMetadata decode(String encoded)
Decode a MessageMetadata from the Cloud Pub/Sub ack id.
Name | Description |
encoded | String |
Type | Description |
MessageMetadata |
Type | Description |
ApiException |
of(Partition partition, Offset offset)
public static MessageMetadata of(Partition partition, Offset offset)
Construct a MessageMetadata from a Partition and Offset.
Name | Description |
partition | Partition |
offset | Offset |
Type | Description |
MessageMetadata |
Constructors
MessageMetadata()
public MessageMetadata()
Methods
encode()
public String encode()
Encode a publish metadata as a Cloud Pub/Sub ack id.
Type | Description |
String |
offset()
public abstract Offset offset()
The offset a message was assigned.
If this MessageMetadata was returned for a publish result and publish idempotence was enabled, the offset may be -1 when the message was identified as a duplicate of an already successfully published message, but the server did not have sufficient information to return the message's offset at publish time. Messages received by subscribers will always have the correct offset.
Type | Description |
Offset |
partition()
public abstract Partition partition()
The partition a message was published to.
Type | Description |
Partition |