public static final class PubsubMessage.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder> 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](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits.Protobuf type
google.pubsub.v1.PubsubMessage
Modifier and Type | Method and Description |
---|---|
PubsubMessage.Builder |
addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) |
PubsubMessage |
build() |
PubsubMessage |
buildPartial() |
PubsubMessage.Builder |
clear() |
PubsubMessage.Builder |
clearAttributes() |
PubsubMessage.Builder |
clearData()
The message data field.
|
PubsubMessage.Builder |
clearField(com.google.protobuf.Descriptors.FieldDescriptor field) |
PubsubMessage.Builder |
clearMessageId()
ID of this message, assigned by the server when the message is published.
|
PubsubMessage.Builder |
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) |
PubsubMessage.Builder |
clearOrderingKey()
If non-empty, identifies related messages for which publish order should be
respected.
|
PubsubMessage.Builder |
clearPublishTime()
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
PubsubMessage.Builder |
clone() |
boolean |
containsAttributes(String key)
Attributes for this message.
|
Map<String,String> |
getAttributes()
Deprecated.
|
int |
getAttributesCount()
Attributes for this message.
|
Map<String,String> |
getAttributesMap()
Attributes for this message.
|
String |
getAttributesOrDefault(String key,
String defaultValue)
Attributes for this message.
|
String |
getAttributesOrThrow(String key)
Attributes for this message.
|
com.google.protobuf.ByteString |
getData()
The message data field.
|
PubsubMessage |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.Descriptors.Descriptor |
getDescriptorForType() |
String |
getMessageId()
ID of this message, assigned by the server when the message is published.
|
com.google.protobuf.ByteString |
getMessageIdBytes()
ID of this message, assigned by the server when the message is published.
|
Map<String,String> |
getMutableAttributes()
Deprecated.
|
String |
getOrderingKey()
If non-empty, identifies related messages for which publish order should be
respected.
|
com.google.protobuf.ByteString |
getOrderingKeyBytes()
If non-empty, identifies related messages for which publish order should be
respected.
|
com.google.protobuf.Timestamp |
getPublishTime()
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
com.google.protobuf.Timestamp.Builder |
getPublishTimeBuilder()
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
com.google.protobuf.TimestampOrBuilder |
getPublishTimeOrBuilder()
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
boolean |
hasPublishTime()
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
protected com.google.protobuf.MapField |
internalGetMapField(int number) |
protected com.google.protobuf.MapField |
internalGetMutableMapField(int number) |
boolean |
isInitialized() |
PubsubMessage.Builder |
mergeFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
PubsubMessage.Builder |
mergeFrom(com.google.protobuf.Message other) |
PubsubMessage.Builder |
mergeFrom(PubsubMessage other) |
PubsubMessage.Builder |
mergePublishTime(com.google.protobuf.Timestamp value)
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
PubsubMessage.Builder |
mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) |
PubsubMessage.Builder |
putAllAttributes(Map<String,String> values)
Attributes for this message.
|
PubsubMessage.Builder |
putAttributes(String key,
String value)
Attributes for this message.
|
PubsubMessage.Builder |
removeAttributes(String key)
Attributes for this message.
|
PubsubMessage.Builder |
setData(com.google.protobuf.ByteString value)
The message data field.
|
PubsubMessage.Builder |
setField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) |
PubsubMessage.Builder |
setMessageId(String value)
ID of this message, assigned by the server when the message is published.
|
PubsubMessage.Builder |
setMessageIdBytes(com.google.protobuf.ByteString value)
ID of this message, assigned by the server when the message is published.
|
PubsubMessage.Builder |
setOrderingKey(String value)
If non-empty, identifies related messages for which publish order should be
respected.
|
PubsubMessage.Builder |
setOrderingKeyBytes(com.google.protobuf.ByteString value)
If non-empty, identifies related messages for which publish order should be
respected.
|
PubsubMessage.Builder |
setPublishTime(com.google.protobuf.Timestamp.Builder builderForValue)
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
PubsubMessage.Builder |
setPublishTime(com.google.protobuf.Timestamp value)
The time at which the message was published, populated by the server when
it receives the `Publish` call.
|
PubsubMessage.Builder |
setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field,
int index,
Object value) |
PubsubMessage.Builder |
setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) |
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.MapField internalGetMapField(int number)
internalGetMapField
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
protected com.google.protobuf.MapField internalGetMutableMapField(int number)
internalGetMutableMapField
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder clear()
clear
in interface com.google.protobuf.Message.Builder
clear
in interface com.google.protobuf.MessageLite.Builder
clear
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
getDescriptorForType
in interface com.google.protobuf.Message.Builder
getDescriptorForType
in interface com.google.protobuf.MessageOrBuilder
getDescriptorForType
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage getDefaultInstanceForType()
getDefaultInstanceForType
in interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType
in interface com.google.protobuf.MessageOrBuilder
public PubsubMessage build()
build
in interface com.google.protobuf.Message.Builder
build
in interface com.google.protobuf.MessageLite.Builder
public PubsubMessage buildPartial()
buildPartial
in interface com.google.protobuf.Message.Builder
buildPartial
in interface com.google.protobuf.MessageLite.Builder
public PubsubMessage.Builder clone()
clone
in interface com.google.protobuf.Message.Builder
clone
in interface com.google.protobuf.MessageLite.Builder
clone
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
setField
in interface com.google.protobuf.Message.Builder
setField
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
clearField
in interface com.google.protobuf.Message.Builder
clearField
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
clearOneof
in interface com.google.protobuf.Message.Builder
clearOneof
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
setRepeatedField
in interface com.google.protobuf.Message.Builder
setRepeatedField
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
addRepeatedField
in interface com.google.protobuf.Message.Builder
addRepeatedField
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder mergeFrom(com.google.protobuf.Message other)
mergeFrom
in interface com.google.protobuf.Message.Builder
mergeFrom
in class com.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder mergeFrom(PubsubMessage other)
public final boolean isInitialized()
isInitialized
in interface com.google.protobuf.MessageLiteOrBuilder
isInitialized
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public PubsubMessage.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
mergeFrom
in interface com.google.protobuf.Message.Builder
mergeFrom
in interface com.google.protobuf.MessageLite.Builder
mergeFrom
in class com.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
IOException
public com.google.protobuf.ByteString getData()
The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1;
getData
in interface PubsubMessageOrBuilder
public PubsubMessage.Builder setData(com.google.protobuf.ByteString value)
The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1;
value
- The data to set.public PubsubMessage.Builder clearData()
The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1;
public int getAttributesCount()
PubsubMessageOrBuilder
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;
getAttributesCount
in interface PubsubMessageOrBuilder
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;
containsAttributes
in interface PubsubMessageOrBuilder
@Deprecated public Map<String,String> getAttributes()
getAttributesMap()
instead.getAttributes
in interface PubsubMessageOrBuilder
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;
getAttributesMap
in interface PubsubMessageOrBuilder
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;
getAttributesOrDefault
in interface PubsubMessageOrBuilder
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;
getAttributesOrThrow
in interface PubsubMessageOrBuilder
public PubsubMessage.Builder clearAttributes()
public PubsubMessage.Builder removeAttributes(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;
@Deprecated public Map<String,String> getMutableAttributes()
public PubsubMessage.Builder putAttributes(String key, String value)
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;
public PubsubMessage.Builder putAllAttributes(Map<String,String> values)
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;
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;
getMessageId
in interface PubsubMessageOrBuilder
public com.google.protobuf.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;
getMessageIdBytes
in interface PubsubMessageOrBuilder
public PubsubMessage.Builder setMessageId(String value)
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;
value
- The messageId to set.public PubsubMessage.Builder clearMessageId()
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;
public PubsubMessage.Builder setMessageIdBytes(com.google.protobuf.ByteString value)
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;
value
- The bytes for messageId to set.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;
hasPublishTime
in interface PubsubMessageOrBuilder
public com.google.protobuf.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;
getPublishTime
in interface PubsubMessageOrBuilder
public PubsubMessage.Builder setPublishTime(com.google.protobuf.Timestamp value)
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;
public PubsubMessage.Builder setPublishTime(com.google.protobuf.Timestamp.Builder builderForValue)
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;
public PubsubMessage.Builder mergePublishTime(com.google.protobuf.Timestamp value)
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;
public PubsubMessage.Builder clearPublishTime()
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;
public com.google.protobuf.Timestamp.Builder getPublishTimeBuilder()
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;
public com.google.protobuf.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;
getPublishTimeOrBuilder
in interface PubsubMessageOrBuilder
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 `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
string ordering_key = 5;
getOrderingKey
in interface PubsubMessageOrBuilder
public com.google.protobuf.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 `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
string ordering_key = 5;
getOrderingKeyBytes
in interface PubsubMessageOrBuilder
public PubsubMessage.Builder setOrderingKey(String value)
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 `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
string ordering_key = 5;
value
- The orderingKey to set.public PubsubMessage.Builder clearOrderingKey()
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 `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
string ordering_key = 5;
public PubsubMessage.Builder setOrderingKeyBytes(com.google.protobuf.ByteString value)
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 `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
string ordering_key = 5;
value
- The bytes for orderingKey to set.public final PubsubMessage.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
setUnknownFields
in interface com.google.protobuf.Message.Builder
setUnknownFields
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
public final PubsubMessage.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
mergeUnknownFields
in interface com.google.protobuf.Message.Builder
mergeUnknownFields
in class com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
Copyright © 2023 Google LLC. All rights reserved.