Package com.google.pubsub.v1
Class PubsubMessage.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
com.google.pubsub.v1.PubsubMessage.Builder
- All Implemented Interfaces:
com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,PubsubMessageOrBuilder,Cloneable
- Enclosing class:
- PubsubMessage
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-
Method Summary
Modifier and TypeMethodDescriptionaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()The message data field.clearField(com.google.protobuf.Descriptors.FieldDescriptor field) ID of this message, assigned by the server when the message is published.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) If non-empty, identifies related messages for which publish order should be respected.The time at which the message was published, populated by the server when it receives the `Publish` call.clone()booleancontainsAttributes(String key) Attributes for this message.Deprecated.intAttributes for this message.Attributes for this message.getAttributesOrDefault(String key, String defaultValue) Attributes for this message.Attributes for this message.com.google.protobuf.ByteStringgetData()The message data field.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorID of this message, assigned by the server when the message is published.com.google.protobuf.ByteStringID of this message, assigned by the server when the message is published.Deprecated.If non-empty, identifies related messages for which publish order should be respected.com.google.protobuf.ByteStringIf non-empty, identifies related messages for which publish order should be respected.com.google.protobuf.TimestampThe time at which the message was published, populated by the server when it receives the `Publish` call.com.google.protobuf.Timestamp.BuilderThe time at which the message was published, populated by the server when it receives the `Publish` call.com.google.protobuf.TimestampOrBuilderThe time at which the message was published, populated by the server when it receives the `Publish` call.booleanThe time at which the message was published, populated by the server when it receives the `Publish` call.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableprotected com.google.protobuf.MapFieldinternalGetMapField(int number) protected com.google.protobuf.MapFieldinternalGetMutableMapField(int number) final booleanmergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeFrom(PubsubMessage other) mergePublishTime(com.google.protobuf.Timestamp value) The time at which the message was published, populated by the server when it receives the `Publish` call.final PubsubMessage.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) putAllAttributes(Map<String, String> values) Attributes for this message.putAttributes(String key, String value) Attributes for this message.removeAttributes(String key) Attributes for this message.setData(com.google.protobuf.ByteString value) The message data field.setMessageId(String value) ID of this message, assigned by the server when the message is published.setMessageIdBytes(com.google.protobuf.ByteString value) ID of this message, assigned by the server when the message is published.setOrderingKey(String value) If non-empty, identifies related messages for which publish order should be respected.setOrderingKeyBytes(com.google.protobuf.ByteString value) If non-empty, identifies related messages for which publish order should be respected.setPublishTime(com.google.protobuf.Timestamp value) The time at which the message was published, populated by the server when it receives the `Publish` call.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.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) final PubsubMessage.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapFieldReflection, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetMapField
protected com.google.protobuf.MapField internalGetMapField(int number) - Overrides:
internalGetMapFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
internalGetMutableMapField
protected com.google.protobuf.MapField internalGetMutableMapField(int number) - Overrides:
internalGetMutableMapFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
setField
public PubsubMessage.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clearField
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clearOneof
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
setRepeatedField
public PubsubMessage.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
addRepeatedField
public PubsubMessage.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
mergeFrom
public PubsubMessage.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>- Throws:
IOException
-
getData
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;- Specified by:
getDatain interfacePubsubMessageOrBuilder- Returns:
- The data.
-
setData
The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1;- Parameters:
value- The data to set.- Returns:
- This builder for chaining.
-
clearData
The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1;- Returns:
- This builder for chaining.
-
getAttributesCount
public int getAttributesCount()Description copied from interface:PubsubMessageOrBuilderAttributes 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;- Specified by:
getAttributesCountin interfacePubsubMessageOrBuilder
-
containsAttributes
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;- Specified by:
containsAttributesin interfacePubsubMessageOrBuilder
-
getAttributes
Deprecated.UsegetAttributesMap()instead.- Specified by:
getAttributesin interfacePubsubMessageOrBuilder
-
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;- Specified by:
getAttributesMapin interfacePubsubMessageOrBuilder
-
getAttributesOrDefault
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;- Specified by:
getAttributesOrDefaultin interfacePubsubMessageOrBuilder
-
getAttributesOrThrow
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;- Specified by:
getAttributesOrThrowin interfacePubsubMessageOrBuilder
-
clearAttributes
-
removeAttributes
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; -
getMutableAttributes
Deprecated.Use alternate mutation accessors instead. -
putAttributes
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; -
putAllAttributes
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; -
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;- Specified by:
getMessageIdin interfacePubsubMessageOrBuilder- Returns:
- The messageId.
-
getMessageIdBytes
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;- Specified by:
getMessageIdBytesin interfacePubsubMessageOrBuilder- Returns:
- The bytes for messageId.
-
setMessageId
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;- Parameters:
value- The messageId to set.- Returns:
- This builder for chaining.
-
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;- Returns:
- This builder for chaining.
-
setMessageIdBytes
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;- Parameters:
value- The bytes for messageId to set.- Returns:
- This builder for chaining.
-
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;- Specified by:
hasPublishTimein interfacePubsubMessageOrBuilder- Returns:
- Whether the publishTime field is set.
-
getPublishTime
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;- Specified by:
getPublishTimein interfacePubsubMessageOrBuilder- Returns:
- The publishTime.
-
setPublishTime
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; -
setPublishTime
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; -
mergePublishTime
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; -
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; -
getPublishTimeBuilder
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; -
getPublishTimeOrBuilder
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;- Specified by:
getPublishTimeOrBuilderin interfacePubsubMessageOrBuilder
-
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;- Specified by:
getOrderingKeyin interfacePubsubMessageOrBuilder- Returns:
- The orderingKey.
-
getOrderingKeyBytes
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;- Specified by:
getOrderingKeyBytesin interfacePubsubMessageOrBuilder- Returns:
- The bytes for orderingKey.
-
setOrderingKey
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;- Parameters:
value- The orderingKey to set.- Returns:
- This builder for chaining.
-
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;- Returns:
- This builder for chaining.
-
setOrderingKeyBytes
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;- Parameters:
value- The bytes for orderingKey to set.- Returns:
- This builder for chaining.
-
setUnknownFields
public final PubsubMessage.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
mergeUnknownFields
public final PubsubMessage.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-