public class NewTopic extends Object
Admin.createTopics(Collection)
.Constructor and Description |
---|
NewTopic(String name,
int numPartitions,
short replicationFactor)
A new topic with the specified replication factor and number of partitions.
|
NewTopic(String name,
Map<Integer,List<Integer>> replicasAssignments)
A new topic with the specified replica assignment configuration.
|
NewTopic(String name,
Optional<Integer> numPartitions,
Optional<Short> replicationFactor)
A new topic that optionally defaults
numPartitions and replicationFactor to
the broker configurations for num.partitions and default.replication.factor
respectively. |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
configs()
The configuration for the new topic or null if no configs ever specified.
|
NewTopic |
configs(Map<String,String> configs)
Set the configuration to use on the new topic.
|
boolean |
equals(Object o) |
int |
hashCode() |
Optional<NewMirrorTopic> |
mirror()
The mirror information for topic creation.
|
NewTopic |
mirror(Optional<NewMirrorTopic> mirror)
Sets the mirror information for topic creation.
|
String |
name()
The name of the topic to be created.
|
int |
numPartitions()
The number of partitions for the new topic or -1 if a replica assignment has been specified.
|
Map<Integer,List<Integer>> |
replicasAssignments()
A map from partition id to replica ids (i.e.
|
short |
replicationFactor()
The replication factor for the new topic or -1 if a replica assignment has been specified.
|
String |
toString() |
public NewTopic(String name, int numPartitions, short replicationFactor)
public NewTopic(String name, Optional<Integer> numPartitions, Optional<Short> replicationFactor)
numPartitions
and replicationFactor
to
the broker configurations for num.partitions
and default.replication.factor
respectively.public NewTopic(String name, Map<Integer,List<Integer>> replicasAssignments)
name
- the topic name.replicasAssignments
- a map from partition id to replica ids (i.e. broker ids). Although not enforced, it is
generally a good idea for all partitions to have the same number of replicas.public String name()
public int numPartitions()
public short replicationFactor()
public Map<Integer,List<Integer>> replicasAssignments()
public NewTopic configs(Map<String,String> configs)
configs
- The configuration map.public Map<String,String> configs()
public NewTopic mirror(Optional<NewMirrorTopic> mirror)
public Optional<NewMirrorTopic> mirror()