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()
Optional.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) Optional.The time at which the message was published, populated by the server when it receives the `Publish` call.clone()
boolean
containsAttributes
(String key) Optional.Deprecated.int
Optional.Optional.getAttributesOrDefault
(String key, String defaultValue) Optional.Optional.com.google.protobuf.ByteString
getData()
Optional.static final com.google.protobuf.Descriptors.Descriptor
com.google.protobuf.Descriptors.Descriptor
ID of this message, assigned by the server when the message is published.com.google.protobuf.ByteString
ID of this message, assigned by the server when the message is published.Deprecated.Optional.com.google.protobuf.ByteString
Optional.com.google.protobuf.Timestamp
The time at which the message was published, populated by the server when it receives the `Publish` call.com.google.protobuf.Timestamp.Builder
The time at which the message was published, populated by the server when it receives the `Publish` call.com.google.protobuf.TimestampOrBuilder
The time at which the message was published, populated by the server when it receives the `Publish` call.boolean
The time at which the message was published, populated by the server when it receives the `Publish` call.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
protected com.google.protobuf.MapField
internalGetMapField
(int number) protected com.google.protobuf.MapField
internalGetMutableMapField
(int number) final boolean
mergeFrom
(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.Builder
mergeUnknownFields
(com.google.protobuf.UnknownFieldSet unknownFields) putAllAttributes
(Map<String, String> values) Optional.putAttributes
(String key, String value) Optional.removeAttributes
(String key) Optional.setData
(com.google.protobuf.ByteString value) Optional.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) Optional.setOrderingKeyBytes
(com.google.protobuf.ByteString value) Optional.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.Builder
setUnknownFields
(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, 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
Methods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFrom
Methods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFrom
Methods 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:
internalGetMapField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
internalGetMutableMapField
protected com.google.protobuf.MapField internalGetMutableMapField(int number) - Overrides:
internalGetMutableMapField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTable
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clear
- Specified by:
clear
in interfacecom.google.protobuf.Message.Builder
- Specified by:
clear
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
clear
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.Message.Builder
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.MessageOrBuilder
- Overrides:
getDescriptorForType
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
build
in interfacecom.google.protobuf.Message.Builder
- Specified by:
build
in interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartial
in interfacecom.google.protobuf.Message.Builder
- Specified by:
buildPartial
in interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clone
in interfacecom.google.protobuf.Message.Builder
- Specified by:
clone
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
clone
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
setField
public PubsubMessage.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
setField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clearField
- Specified by:
clearField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
clearField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clearOneof
- Specified by:
clearOneof
in interfacecom.google.protobuf.Message.Builder
- Overrides:
clearOneof
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
setRepeatedField
public PubsubMessage.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
setRepeatedField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
addRepeatedField
public PubsubMessage.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
addRepeatedField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
mergeFrom
- Specified by:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in 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:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Specified by:
mergeFrom
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
- Throws:
IOException
-
getData
public com.google.protobuf.ByteString getData()Optional. The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getData
in interfacePubsubMessageOrBuilder
- Returns:
- The data.
-
setData
Optional. The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1 [(.google.api.field_behavior) = OPTIONAL];
- Parameters:
value
- The data to set.- Returns:
- This builder for chaining.
-
clearData
Optional. The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1 [(.google.api.field_behavior) = OPTIONAL];
- Returns:
- This builder for chaining.
-
getAttributesCount
public int getAttributesCount()Description copied from interface:PubsubMessageOrBuilder
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getAttributesCount
in interfacePubsubMessageOrBuilder
-
containsAttributes
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
containsAttributes
in interfacePubsubMessageOrBuilder
-
getAttributes
Deprecated.UsegetAttributesMap()
instead.- Specified by:
getAttributes
in interfacePubsubMessageOrBuilder
-
getAttributesMap
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getAttributesMap
in interfacePubsubMessageOrBuilder
-
getAttributesOrDefault
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getAttributesOrDefault
in interfacePubsubMessageOrBuilder
-
getAttributesOrThrow
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getAttributesOrThrow
in interfacePubsubMessageOrBuilder
-
clearAttributes
-
removeAttributes
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
-
getMutableAttributes
Deprecated.Use alternate mutation accessors instead. -
putAttributes
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
-
putAllAttributes
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
-
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:
getMessageId
in 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:
getMessageIdBytes
in 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:
hasPublishTime
in 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:
getPublishTime
in 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:
getPublishTimeOrBuilder
in interfacePubsubMessageOrBuilder
-
getOrderingKey
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getOrderingKey
in interfacePubsubMessageOrBuilder
- Returns:
- The orderingKey.
-
getOrderingKeyBytes
public com.google.protobuf.ByteString getOrderingKeyBytes()Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Specified by:
getOrderingKeyBytes
in interfacePubsubMessageOrBuilder
- Returns:
- The bytes for orderingKey.
-
setOrderingKey
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Parameters:
value
- The orderingKey to set.- Returns:
- This builder for chaining.
-
clearOrderingKey
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- Returns:
- This builder for chaining.
-
setOrderingKeyBytes
Optional. 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 [(.google.api.field_behavior) = OPTIONAL];
- 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:
setUnknownFields
in interfacecom.google.protobuf.Message.Builder
- Overrides:
setUnknownFields
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
mergeUnknownFields
public final PubsubMessage.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFields
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeUnknownFields
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-