Class PubSubMessage.Builder (1.14.4)

public static final class PubSubMessage.Builder extends GeneratedMessageV3.Builder<PubSubMessage.Builder> implements PubSubMessageOrBuilder

A message that is published by publishers and delivered to subscribers.

Protobuf type google.cloud.pubsublite.v1.PubSubMessage

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public PubSubMessage.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
PubSubMessage.Builder
Overrides

build()

public PubSubMessage build()
Returns
Type Description
PubSubMessage

buildPartial()

public PubSubMessage buildPartial()
Returns
Type Description
PubSubMessage

clear()

public PubSubMessage.Builder clear()
Returns
Type Description
PubSubMessage.Builder
Overrides

clearAttributes()

public PubSubMessage.Builder clearAttributes()
Returns
Type Description
PubSubMessage.Builder

clearData()

public PubSubMessage.Builder clearData()

The payload of the message.

bytes data = 2;

Returns
Type Description
PubSubMessage.Builder

This builder for chaining.

clearEventTime()

public PubSubMessage.Builder clearEventTime()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
Type Description
PubSubMessage.Builder

clearField(Descriptors.FieldDescriptor field)

public PubSubMessage.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
PubSubMessage.Builder
Overrides

clearKey()

public PubSubMessage.Builder clearKey()

The key used for routing messages to partitions or for compaction (e.g., keep the last N messages per key). If the key is empty, the message is routed to an arbitrary partition.

bytes key = 1;

Returns
Type Description
PubSubMessage.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public PubSubMessage.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
PubSubMessage.Builder
Overrides

clone()

public PubSubMessage.Builder clone()
Returns
Type Description
PubSubMessage.Builder
Overrides

containsAttributes(String key)

public boolean containsAttributes(String key)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameter
Name Description
key String
Returns
Type Description
boolean

getAttributes() (deprecated)

public Map<String,AttributeValues> getAttributes()

Use #getAttributesMap() instead.

Returns
Type Description
Map<String,AttributeValues>

getAttributesCount()

public int getAttributesCount()

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Returns
Type Description
int

getAttributesMap()

public Map<String,AttributeValues> getAttributesMap()

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Returns
Type Description
Map<String,AttributeValues>

getAttributesOrDefault(String key, AttributeValues defaultValue)

public AttributeValues getAttributesOrDefault(String key, AttributeValues defaultValue)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameters
Name Description
key String
defaultValue AttributeValues
Returns
Type Description
AttributeValues

getAttributesOrThrow(String key)

public AttributeValues getAttributesOrThrow(String key)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameter
Name Description
key String
Returns
Type Description
AttributeValues

getData()

public ByteString getData()

The payload of the message.

bytes data = 2;

Returns
Type Description
ByteString

The data.

getDefaultInstanceForType()

public PubSubMessage getDefaultInstanceForType()
Returns
Type Description
PubSubMessage

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getEventTime()

public Timestamp getEventTime()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
Type Description
Timestamp

The eventTime.

getEventTimeBuilder()

public Timestamp.Builder getEventTimeBuilder()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
Type Description
Builder

getEventTimeOrBuilder()

public TimestampOrBuilder getEventTimeOrBuilder()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
Type Description
TimestampOrBuilder

getKey()

public ByteString getKey()

The key used for routing messages to partitions or for compaction (e.g., keep the last N messages per key). If the key is empty, the message is routed to an arbitrary partition.

bytes key = 1;

Returns
Type Description
ByteString

The key.

getMutableAttributes() (deprecated)

public Map<String,AttributeValues> getMutableAttributes()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,AttributeValues>

hasEventTime()

public boolean hasEventTime()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
Type Description
boolean

Whether the eventTime field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeEventTime(Timestamp value)

public PubSubMessage.Builder mergeEventTime(Timestamp value)

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Parameter
Name Description
value Timestamp
Returns
Type Description
PubSubMessage.Builder

mergeFrom(PubSubMessage other)

public PubSubMessage.Builder mergeFrom(PubSubMessage other)
Parameter
Name Description
other PubSubMessage
Returns
Type Description
PubSubMessage.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public PubSubMessage.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
PubSubMessage.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public PubSubMessage.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
PubSubMessage.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final PubSubMessage.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
PubSubMessage.Builder
Overrides

putAllAttributes(Map<String,AttributeValues> values)

public PubSubMessage.Builder putAllAttributes(Map<String,AttributeValues> values)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameter
Name Description
values Map<String,AttributeValues>
Returns
Type Description
PubSubMessage.Builder

putAttributes(String key, AttributeValues value)

public PubSubMessage.Builder putAttributes(String key, AttributeValues value)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameters
Name Description
key String
value AttributeValues
Returns
Type Description
PubSubMessage.Builder

putAttributesBuilderIfAbsent(String key)

public AttributeValues.Builder putAttributesBuilderIfAbsent(String key)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameter
Name Description
key String
Returns
Type Description
AttributeValues.Builder

removeAttributes(String key)

public PubSubMessage.Builder removeAttributes(String key)

Optional attributes that can be used for message metadata/headers.

map<string, .google.cloud.pubsublite.v1.AttributeValues> attributes = 3;

Parameter
Name Description
key String
Returns
Type Description
PubSubMessage.Builder

setData(ByteString value)

public PubSubMessage.Builder setData(ByteString value)

The payload of the message.

bytes data = 2;

Parameter
Name Description
value ByteString

The data to set.

Returns
Type Description
PubSubMessage.Builder

This builder for chaining.

setEventTime(Timestamp value)

public PubSubMessage.Builder setEventTime(Timestamp value)

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Parameter
Name Description
value Timestamp
Returns
Type Description
PubSubMessage.Builder

setEventTime(Timestamp.Builder builderForValue)

public PubSubMessage.Builder setEventTime(Timestamp.Builder builderForValue)

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
PubSubMessage.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public PubSubMessage.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
PubSubMessage.Builder
Overrides

setKey(ByteString value)

public PubSubMessage.Builder setKey(ByteString value)

The key used for routing messages to partitions or for compaction (e.g., keep the last N messages per key). If the key is empty, the message is routed to an arbitrary partition.

bytes key = 1;

Parameter
Name Description
value ByteString

The key to set.

Returns
Type Description
PubSubMessage.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public PubSubMessage.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
PubSubMessage.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final PubSubMessage.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
PubSubMessage.Builder
Overrides