Package org.springframework.kafka.config
Class TopicBuilder
java.lang.Object
org.springframework.kafka.config.TopicBuilder
Builder for a
NewTopic. Since 2.6 partitions and replicas default to
Optional.empty() indicating the broker defaults will be applied.- Since:
- 2.3
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionassignReplicas(int partition, List<Integer> replicaList) Add an individual replica assignment.org.apache.kafka.clients.admin.NewTopicbuild()compact()Set theTopicConfig.CLEANUP_POLICY_CONFIGtoTopicConfig.CLEANUP_POLICY_COMPACT.Set a configuration option.Set the configs.static TopicBuilderCreate a TopicBuilder with the supplied name.partitions(int partitionCount) Set the number of partitions (default broker 'num.partitions').replicas(int replicaCount) Set the number of replicas (default broker 'default.replication.factor').replicasAssignments(Map<Integer, List<Integer>> replicaAssignments) Set the replica assignments.
-
Method Details
-
partitions
Set the number of partitions (default broker 'num.partitions').- Parameters:
partitionCount- the partitions.- Returns:
- the builder.
-
replicas
Set the number of replicas (default broker 'default.replication.factor').- Parameters:
replicaCount- the replicas (which will be cast to short).- Returns:
- the builder.
-
replicasAssignments
Set the replica assignments.- Parameters:
replicaAssignments- the assignments.- Returns:
- the builder.
- See Also:
-
NewTopic.replicasAssignments()
-
assignReplicas
Add an individual replica assignment.- Parameters:
partition- the partition.replicaList- the replicas.- Returns:
- the builder.
- See Also:
-
NewTopic.replicasAssignments()
-
configs
Set the configs.- Parameters:
configProps- the configs.- Returns:
- the builder.
- See Also:
-
NewTopic.configs()
-
config
Set a configuration option.- Parameters:
configName- the name.configValue- the value.- Returns:
- the builder
- See Also:
-
TopicConfig
-
compact
Set theTopicConfig.CLEANUP_POLICY_CONFIGtoTopicConfig.CLEANUP_POLICY_COMPACT.- Returns:
- the builder.
-
build
public org.apache.kafka.clients.admin.NewTopic build() -
name
Create a TopicBuilder with the supplied name.- Parameters:
name- the name.- Returns:
- the builder.
-