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 typegoogle.pubsub.v1.PubsubMessage
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PubsubMessage.BuilderaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)PubsubMessagebuild()PubsubMessagebuildPartial()PubsubMessage.Builderclear()PubsubMessage.BuilderclearAttributes()PubsubMessage.BuilderclearData()The message data field.PubsubMessage.BuilderclearField(com.google.protobuf.Descriptors.FieldDescriptor field)PubsubMessage.BuilderclearMessageId()ID of this message, assigned by the server when the message is published.PubsubMessage.BuilderclearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)PubsubMessage.BuilderclearOrderingKey()If non-empty, identifies related messages for which publish order should be respected.PubsubMessage.BuilderclearPublishTime()The time at which the message was published, populated by the server when it receives the `Publish` call.PubsubMessage.Builderclone()booleancontainsAttributes(String key)Attributes for this message.Map<String,String>getAttributes()Deprecated.intgetAttributesCount()Attributes for this message.Map<String,String>getAttributesMap()Attributes for this message.StringgetAttributesOrDefault(String key, String defaultValue)Attributes for this message.StringgetAttributesOrThrow(String key)Attributes for this message.com.google.protobuf.ByteStringgetData()The message data field.PubsubMessagegetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()StringgetMessageId()ID of this message, assigned by the server when the message is published.com.google.protobuf.ByteStringgetMessageIdBytes()ID of this message, assigned by the server when the message is published.Map<String,String>getMutableAttributes()Deprecated.StringgetOrderingKey()If non-empty, identifies related messages for which publish order should be respected.com.google.protobuf.ByteStringgetOrderingKeyBytes()If non-empty, identifies related messages for which publish order should be respected.com.google.protobuf.TimestampgetPublishTime()The time at which the message was published, populated by the server when it receives the `Publish` call.com.google.protobuf.Timestamp.BuildergetPublishTimeBuilder()The time at which the message was published, populated by the server when it receives the `Publish` call.com.google.protobuf.TimestampOrBuildergetPublishTimeOrBuilder()The time at which the message was published, populated by the server when it receives the `Publish` call.booleanhasPublishTime()The time at which the message was published, populated by the server when it receives the `Publish` call.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()protected com.google.protobuf.MapFieldinternalGetMapField(int number)protected com.google.protobuf.MapFieldinternalGetMutableMapField(int number)booleanisInitialized()PubsubMessage.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)PubsubMessage.BuildermergeFrom(com.google.protobuf.Message other)PubsubMessage.BuildermergeFrom(PubsubMessage other)PubsubMessage.BuildermergePublishTime(com.google.protobuf.Timestamp value)The time at which the message was published, populated by the server when it receives the `Publish` call.PubsubMessage.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)PubsubMessage.BuilderputAllAttributes(Map<String,String> values)Attributes for this message.PubsubMessage.BuilderputAttributes(String key, String value)Attributes for this message.PubsubMessage.BuilderremoveAttributes(String key)Attributes for this message.PubsubMessage.BuildersetData(com.google.protobuf.ByteString value)The message data field.PubsubMessage.BuildersetField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)PubsubMessage.BuildersetMessageId(String value)ID of this message, assigned by the server when the message is published.PubsubMessage.BuildersetMessageIdBytes(com.google.protobuf.ByteString value)ID of this message, assigned by the server when the message is published.PubsubMessage.BuildersetOrderingKey(String value)If non-empty, identifies related messages for which publish order should be respected.PubsubMessage.BuildersetOrderingKeyBytes(com.google.protobuf.ByteString value)If non-empty, identifies related messages for which publish order should be respected.PubsubMessage.BuildersetPublishTime(com.google.protobuf.Timestamp value)The time at which the message was published, populated by the server when it receives the `Publish` call.PubsubMessage.BuildersetPublishTime(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.BuildersetRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)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, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3
-
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
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
public 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
public PubsubMessage getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public PubsubMessage build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public PubsubMessage buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
public PubsubMessage.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
public PubsubMessage.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clearOneof
public PubsubMessage.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- 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
public PubsubMessage.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
-
mergeFrom
public PubsubMessage.Builder mergeFrom(PubsubMessage other)
-
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
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;- Parameters:
value- The data to set.- Returns:
- This builder for chaining.
-
clearData
public PubsubMessage.Builder 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
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;- Specified by:
containsAttributesin interfacePubsubMessageOrBuilder
-
getAttributes
@Deprecated public Map<String,String> getAttributes()
Deprecated.UsegetAttributesMap()instead.- Specified by:
getAttributesin interfacePubsubMessageOrBuilder
-
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;- Specified by:
getAttributesMapin interfacePubsubMessageOrBuilder
-
getAttributesOrDefault
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;- Specified by:
getAttributesOrDefaultin interfacePubsubMessageOrBuilder
-
getAttributesOrThrow
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;- Specified by:
getAttributesOrThrowin interfacePubsubMessageOrBuilder
-
clearAttributes
public PubsubMessage.Builder clearAttributes()
-
removeAttributes
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;
-
getMutableAttributes
@Deprecated public Map<String,String> getMutableAttributes()
Deprecated.Use alternate mutation accessors instead.
-
putAttributes
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;
-
putAllAttributes
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;
-
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;- 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
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;- Parameters:
value- The messageId to set.- Returns:
- This builder for chaining.
-
clearMessageId
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;- Returns:
- This builder for chaining.
-
setMessageIdBytes
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;- 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
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;
-
setPublishTime
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;
-
mergePublishTime
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;
-
clearPublishTime
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;
-
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
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;- 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
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;- Parameters:
value- The orderingKey to set.- Returns:
- This builder for chaining.
-
clearOrderingKey
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;- Returns:
- This builder for chaining.
-
setOrderingKeyBytes
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;- 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>
-
-