Package org.springframework.kafka.config
Class TopicBuilder
- java.lang.Object
-
- org.springframework.kafka.config.TopicBuilder
-
public final class TopicBuilder extends java.lang.ObjectBuilder for aNewTopic. Since 2.6 partitions and replicas default toOptional.empty()indicating the broker defaults will be applied.- Since:
- 2.3
- Author:
- Gary Russell
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TopicBuilderassignReplicas(int partition, java.util.List<java.lang.Integer> replicaList)Add an individual replica assignment.org.apache.kafka.clients.admin.NewTopicbuild()TopicBuildercompact()Set theTopicConfig.CLEANUP_POLICY_CONFIGtoTopicConfig.CLEANUP_POLICY_COMPACT.TopicBuilderconfig(java.lang.String configName, java.lang.String configValue)Set a configuration option.TopicBuilderconfigs(java.util.Map<java.lang.String,java.lang.String> configProps)Set the configs.static TopicBuildername(java.lang.String name)Create a TopicBuilder with the supplied name.TopicBuilderpartitions(int partitionCount)Set the number of partitions (default broker 'num.partitions').TopicBuilderreplicas(int replicaCount)Set the number of replicas (default broker 'default.replication.factor').TopicBuilderreplicasAssignments(java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> replicaAssignments)Set the replica assignments.
-
-
-
Method Detail
-
partitions
public TopicBuilder partitions(int partitionCount)
Set the number of partitions (default broker 'num.partitions').- Parameters:
partitionCount- the partitions.- Returns:
- the builder.
-
replicas
public TopicBuilder replicas(int replicaCount)
Set the number of replicas (default broker 'default.replication.factor').- Parameters:
replicaCount- the replicas (which will be cast to short).- Returns:
- the builder.
-
replicasAssignments
public TopicBuilder replicasAssignments(java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> replicaAssignments)
Set the replica assignments.- Parameters:
replicaAssignments- the assignments.- Returns:
- the builder.
- See Also:
NewTopic.replicasAssignments()
-
assignReplicas
public TopicBuilder assignReplicas(int partition, java.util.List<java.lang.Integer> replicaList)
Add an individual replica assignment.- Parameters:
partition- the partition.replicaList- the replicas.- Returns:
- the builder.
- See Also:
NewTopic.replicasAssignments()
-
configs
public TopicBuilder configs(java.util.Map<java.lang.String,java.lang.String> configProps)
Set the configs.- Parameters:
configProps- the configs.- Returns:
- the builder.
- See Also:
NewTopic.configs()
-
config
public TopicBuilder config(java.lang.String configName, java.lang.String configValue)
Set a configuration option.- Parameters:
configName- the name.configValue- the value.- Returns:
- the builder
- See Also:
TopicConfig
-
compact
public TopicBuilder compact()
Set theTopicConfig.CLEANUP_POLICY_CONFIGtoTopicConfig.CLEANUP_POLICY_COMPACT.- Returns:
- the builder.
-
build
public org.apache.kafka.clients.admin.NewTopic build()
-
name
public static TopicBuilder name(java.lang.String name)
Create a TopicBuilder with the supplied name.- Parameters:
name- the name.- Returns:
- the builder.
-
-