Class PubSubMessage.Builder (1.12.22)

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
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public PubSubMessage.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
PubSubMessage.Builder
Overrides

build()

public PubSubMessage build()
Returns
TypeDescription
PubSubMessage

buildPartial()

public PubSubMessage buildPartial()
Returns
TypeDescription
PubSubMessage

clear()

public PubSubMessage.Builder clear()
Returns
TypeDescription
PubSubMessage.Builder
Overrides

clearAttributes()

public PubSubMessage.Builder clearAttributes()
Returns
TypeDescription
PubSubMessage.Builder

clearData()

public PubSubMessage.Builder clearData()

The payload of the message.

bytes data = 2;

Returns
TypeDescription
PubSubMessage.Builder

This builder for chaining.

clearEventTime()

public PubSubMessage.Builder clearEventTime()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
TypeDescription
PubSubMessage.Builder

clearField(Descriptors.FieldDescriptor field)

public PubSubMessage.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
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
TypeDescription
PubSubMessage.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public PubSubMessage.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
PubSubMessage.Builder
Overrides

clone()

public PubSubMessage.Builder clone()
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
boolean

getAttributes()

public Map<String,AttributeValues> getAttributes()

Use #getAttributesMap() instead.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
keyString
defaultValueAttributeValues
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
AttributeValues

getData()

public ByteString getData()

The payload of the message.

bytes data = 2;

Returns
TypeDescription
ByteString

The data.

getDefaultInstanceForType()

public PubSubMessage getDefaultInstanceForType()
Returns
TypeDescription
PubSubMessage

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getEventTime()

public Timestamp getEventTime()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
TypeDescription
Timestamp

The eventTime.

getEventTimeBuilder()

public Timestamp.Builder getEventTimeBuilder()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
TypeDescription
Builder

getEventTimeOrBuilder()

public TimestampOrBuilder getEventTimeOrBuilder()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
TypeDescription
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
TypeDescription
ByteString

The key.

getMutableAttributes()

public Map<String,AttributeValues> getMutableAttributes()

Use alternate mutation accessors instead.

Returns
TypeDescription
Map<String,AttributeValues>

hasEventTime()

public boolean hasEventTime()

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Returns
TypeDescription
boolean

Whether the eventTime field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

internalGetMutableMapField(int number)

protected MapField internalGetMutableMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeEventTime(Timestamp value)

public PubSubMessage.Builder mergeEventTime(Timestamp value)

An optional, user-specified event time.

.google.protobuf.Timestamp event_time = 4;

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
PubSubMessage.Builder

mergeFrom(PubSubMessage other)

public PubSubMessage.Builder mergeFrom(PubSubMessage other)
Parameter
NameDescription
otherPubSubMessage
Returns
TypeDescription
PubSubMessage.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public PubSubMessage.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
PubSubMessage.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public PubSubMessage.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
PubSubMessage.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final PubSubMessage.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
valuesMap<String,AttributeValues>
Returns
TypeDescription
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
NameDescription
keyString
valueAttributeValues
Returns
TypeDescription
PubSubMessage.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
NameDescription
keyString
Returns
TypeDescription
PubSubMessage.Builder

setData(ByteString value)

public PubSubMessage.Builder setData(ByteString value)

The payload of the message.

bytes data = 2;

Parameter
NameDescription
valueByteString

The data to set.

Returns
TypeDescription
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
NameDescription
valueTimestamp
Returns
TypeDescription
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
NameDescription
builderForValueBuilder
Returns
TypeDescription
PubSubMessage.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public PubSubMessage.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
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
NameDescription
valueByteString

The key to set.

Returns
TypeDescription
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
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
PubSubMessage.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final PubSubMessage.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
PubSubMessage.Builder
Overrides