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.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 value)
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.Builder builderForValue)
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)
-
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:
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
public 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
public PubsubMessage getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageOrBuilder
-
build
public PubsubMessage build()
- Specified by:
build
in interfacecom.google.protobuf.Message.Builder
- Specified by:
build
in interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public PubsubMessage buildPartial()
- Specified by:
buildPartial
in interfacecom.google.protobuf.Message.Builder
- Specified by:
buildPartial
in interfacecom.google.protobuf.MessageLite.Builder
-
clone
public PubsubMessage.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
public PubsubMessage.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
clearField
in classcom.google.protobuf.GeneratedMessageV3.Builder<PubsubMessage.Builder>
-
clearOneof
public PubsubMessage.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- 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
public PubsubMessage.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<PubsubMessage.Builder>
-
mergeFrom
public PubsubMessage.Builder mergeFrom(PubsubMessage other)
-
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()
The message data field. If this field is empty, the message must contain at least one attribute.
bytes data = 1;
- Specified by:
getData
in 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: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;
- Specified by:
getAttributesCount
in 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:
containsAttributes
in interfacePubsubMessageOrBuilder
-
getAttributes
@Deprecated public Map<String,String> getAttributes()
Deprecated.UsegetAttributesMap()
instead.- Specified by:
getAttributes
in 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:
getAttributesMap
in 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:
getAttributesOrDefault
in 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:
getAttributesOrThrow
in 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:
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
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:
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
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:
getPublishTimeOrBuilder
in 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:
getOrderingKey
in 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:
getOrderingKeyBytes
in 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:
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>
-
-