Class Topic.Builder (0.11.0)

public static final class Topic.Builder extends GeneratedMessageV3.Builder<Topic.Builder> implements TopicOrBuilder

A Kafka topic in a given cluster.

Protobuf type google.cloud.managedkafka.v1.Topic

Implements

TopicOrBuilder

Static Methods

getDescriptor()

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

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public Topic build()
Returns
Type Description
Topic

buildPartial()

public Topic buildPartial()
Returns
Type Description
Topic

clear()

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

clearConfigs()

public Topic.Builder clearConfigs()
Returns
Type Description
Topic.Builder

clearField(Descriptors.FieldDescriptor field)

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

clearName()

public Topic.Builder clearName()

Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER];

Returns
Type Description
Topic.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearPartitionCount()

public Topic.Builder clearPartitionCount()

Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected.

int32 partition_count = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
Topic.Builder

This builder for chaining.

clearReplicationFactor()

public Topic.Builder clearReplicationFactor()

Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability.

int32 replication_factor = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
Topic.Builder

This builder for chaining.

clone()

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

containsConfigs(String key)

public boolean containsConfigs(String key)

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
key String
Returns
Type Description
boolean

getConfigs() (deprecated)

public Map<String,String> getConfigs()

Use #getConfigsMap() instead.

Returns
Type Description
Map<String,String>

getConfigsCount()

public int getConfigsCount()

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

getConfigsMap()

public Map<String,String> getConfigsMap()

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
Map<String,String>

getConfigsOrDefault(String key, String defaultValue)

public String getConfigsOrDefault(String key, String defaultValue)

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
key String
defaultValue String
Returns
Type Description
String

getConfigsOrThrow(String key)

public String getConfigsOrThrow(String key)

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
key String
Returns
Type Description
String

getDefaultInstanceForType()

public Topic getDefaultInstanceForType()
Returns
Type Description
Topic

getDescriptorForType()

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

getMutableConfigs() (deprecated)

public Map<String,String> getMutableConfigs()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,String>

getName()

public String getName()

Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER];

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER];

Returns
Type Description
ByteString

The bytes for name.

getPartitionCount()

public int getPartitionCount()

Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected.

int32 partition_count = 2 [(.google.api.field_behavior) = REQUIRED];

Returns
Type Description
int

The partitionCount.

getReplicationFactor()

public int getReplicationFactor()

Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability.

int32 replication_factor = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
int

The replicationFactor.

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

mergeFrom(Topic other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

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

putAllConfigs(Map<String,String> values)

public Topic.Builder putAllConfigs(Map<String,String> values)

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

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

putConfigs(String key, String value)

public Topic.Builder putConfigs(String key, String value)

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameters
Name Description
key String
value String
Returns
Type Description
Topic.Builder

removeConfigs(String key)

public Topic.Builder removeConfigs(String key)

Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy, compression.type.

map<string, string> configs = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
key String
Returns
Type Description
Topic.Builder

setField(Descriptors.FieldDescriptor field, Object value)

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

setName(String value)

public Topic.Builder setName(String value)

Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER];

Parameter
Name Description
value String

The name to set.

Returns
Type Description
Topic.Builder

This builder for chaining.

setNameBytes(ByteString value)

public Topic.Builder setNameBytes(ByteString value)

Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

string name = 1 [(.google.api.field_behavior) = IDENTIFIER];

Parameter
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
Topic.Builder

This builder for chaining.

setPartitionCount(int value)

public Topic.Builder setPartitionCount(int value)

Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected.

int32 partition_count = 2 [(.google.api.field_behavior) = REQUIRED];

Parameter
Name Description
value int

The partitionCount to set.

Returns
Type Description
Topic.Builder

This builder for chaining.

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

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

setReplicationFactor(int value)

public Topic.Builder setReplicationFactor(int value)

Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability.

int32 replication_factor = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value int

The replicationFactor to set.

Returns
Type Description
Topic.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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