Class MessageMetadata (1.7.1)

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.

Inheritance

java.lang.Object > MessageMetadata

Static Methods

decode(String encoded)

public static MessageMetadata decode(String encoded)

Decode a MessageMetadata from the Cloud Pub/Sub ack id.

Parameter
NameDescription
encodedString
Returns
TypeDescription
MessageMetadata
Exceptions
TypeDescription
ApiException

of(Partition partition, Offset offset)

public static MessageMetadata of(Partition partition, Offset offset)

Construct a MessageMetadata from a Partition and Offset.

Parameters
NameDescription
partitionPartition
offsetOffset
Returns
TypeDescription
MessageMetadata

Constructors

MessageMetadata()

public MessageMetadata()

Methods

encode()

public String encode()

Encode a publish metadata as a Cloud Pub/Sub ack id.

Returns
TypeDescription
String

offset()

public abstract Offset offset()

The offset a message was assigned.

Returns
TypeDescription
Offset

partition()

public abstract Partition partition()

The partition a message was published to.

Returns
TypeDescription
Partition