Class PubsubMessage (1.123.13)

public final class PubsubMessage extends GeneratedMessageV3 implements PubsubMessageOrBuilder

A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding client library documentation for more information. See quotas and limits for more information about message limits.

Protobuf type google.pubsub.v1.PubsubMessage

Static Fields

ATTRIBUTES_FIELD_NUMBER

public static final int ATTRIBUTES_FIELD_NUMBER
Field Value
TypeDescription
int

DATA_FIELD_NUMBER

public static final int DATA_FIELD_NUMBER
Field Value
TypeDescription
int

MESSAGE_ID_FIELD_NUMBER

public static final int MESSAGE_ID_FIELD_NUMBER
Field Value
TypeDescription
int

ORDERING_KEY_FIELD_NUMBER

public static final int ORDERING_KEY_FIELD_NUMBER
Field Value
TypeDescription
int

PUBLISH_TIME_FIELD_NUMBER

public static final int PUBLISH_TIME_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static PubsubMessage getDefaultInstance()
Returns
TypeDescription
PubsubMessage

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static PubsubMessage.Builder newBuilder()
Returns
TypeDescription
PubsubMessage.Builder

newBuilder(PubsubMessage prototype)

public static PubsubMessage.Builder newBuilder(PubsubMessage prototype)
Parameter
NameDescription
prototypePubsubMessage
Returns
TypeDescription
PubsubMessage.Builder

parseDelimitedFrom(InputStream input)

public static PubsubMessage parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static PubsubMessage parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static PubsubMessage parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static PubsubMessage parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static PubsubMessage parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static PubsubMessage parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static PubsubMessage parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static PubsubMessage parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static PubsubMessage parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static PubsubMessage parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static PubsubMessage parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static PubsubMessage parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubsubMessage
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<PubsubMessage> parser()
Returns
TypeDescription
Parser<PubsubMessage>

Methods

containsAttributes(String key)

public boolean containsAttributes(String key)

Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.

map<string, string> attributes = 2;

Parameter
NameDescription
keyString
Returns
TypeDescription
boolean

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getAttributes()

public Map<String,String> getAttributes()

Use #getAttributesMap() instead.

Returns
TypeDescription
Map<String,String>

getAttributesCount()

public int getAttributesCount()

Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.

map<string, string> attributes = 2;

Returns
TypeDescription
int

getAttributesMap()

public Map<String,String> getAttributesMap()

Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.

map<string, string> attributes = 2;

Returns
TypeDescription
Map<String,String>

getAttributesOrDefault(String key, String defaultValue)

public String getAttributesOrDefault(String key, String defaultValue)

Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.

map<string, string> attributes = 2;

Parameters
NameDescription
keyString
defaultValueString
Returns
TypeDescription
String

getAttributesOrThrow(String key)

public String getAttributesOrThrow(String key)

Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.

map<string, string> attributes = 2;

Parameter
NameDescription
keyString
Returns
TypeDescription
String

getData()

public ByteString getData()

The message data field. If this field is empty, the message must contain at least one attribute.

bytes data = 1;

Returns
TypeDescription
ByteString

The data.

getDefaultInstanceForType()

public PubsubMessage getDefaultInstanceForType()
Returns
TypeDescription
PubsubMessage

getMessageId()

public String getMessageId()

ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a PubsubMessage via a Pull call or a push delivery. It must not be populated by the publisher in a Publish call.

string message_id = 3;

Returns
TypeDescription
String

The messageId.

getMessageIdBytes()

public ByteString getMessageIdBytes()

ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a PubsubMessage via a Pull call or a push delivery. It must not be populated by the publisher in a Publish call.

string message_id = 3;

Returns
TypeDescription
ByteString

The bytes for messageId.

getOrderingKey()

public String getOrderingKey()

If non-empty, identifies related messages for which publish order should be respected. If a Subscription has enable_message_ordering set to true, messages published with the same non-empty ordering_key value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All PubsubMessages published in a given PublishRequest must specify the same ordering_key value.

string ordering_key = 5;

Returns
TypeDescription
String

The orderingKey.

getOrderingKeyBytes()

public ByteString getOrderingKeyBytes()

If non-empty, identifies related messages for which publish order should be respected. If a Subscription has enable_message_ordering set to true, messages published with the same non-empty ordering_key value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All PubsubMessages published in a given PublishRequest must specify the same ordering_key value.

string ordering_key = 5;

Returns
TypeDescription
ByteString

The bytes for orderingKey.

getParserForType()

public Parser<PubsubMessage> getParserForType()
Returns
TypeDescription
Parser<PubsubMessage>
Overrides

getPublishTime()

public Timestamp getPublishTime()

The time at which the message was published, populated by the server when it receives the Publish call. It must not be populated by the publisher in a Publish call.

.google.protobuf.Timestamp publish_time = 4;

Returns
TypeDescription
Timestamp

The publishTime.

getPublishTimeOrBuilder()

public TimestampOrBuilder getPublishTimeOrBuilder()

The time at which the message was published, populated by the server when it receives the Publish call. It must not be populated by the publisher in a Publish call.

.google.protobuf.Timestamp publish_time = 4;

Returns
TypeDescription
TimestampOrBuilder

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getUnknownFields()

public final UnknownFieldSet getUnknownFields()
Returns
TypeDescription
UnknownFieldSet
Overrides

hasPublishTime()

public boolean hasPublishTime()

The time at which the message was published, populated by the server when it receives the Publish call. It must not be populated by the publisher in a Publish call.

.google.protobuf.Timestamp publish_time = 4;

Returns
TypeDescription
boolean

Whether the publishTime field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public PubsubMessage.Builder newBuilderForType()
Returns
TypeDescription
PubsubMessage.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected PubsubMessage.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
PubsubMessage.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public PubsubMessage.Builder toBuilder()
Returns
TypeDescription
PubsubMessage.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException