public class NewTopic
extends java.lang.Object
Admin.createTopics(Collection)
.Constructor and Description |
---|
NewTopic(java.lang.String name,
int numPartitions,
short replicationFactor)
A new topic with the specified replication factor and number of partitions.
|
NewTopic(java.lang.String name,
java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> replicasAssignments)
A new topic with the specified replica assignment configuration.
|
NewTopic(java.lang.String name,
java.util.Optional<java.lang.Integer> numPartitions,
java.util.Optional<java.lang.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 |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
configs()
The configuration for the new topic or null if no configs ever specified.
|
NewTopic |
configs(java.util.Map<java.lang.String,java.lang.String> configs)
Set the configuration to use on the new topic.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
java.util.Optional<NewTopicMirror> |
mirror()
The mirror information for topic creation.
|
NewTopic |
mirror(java.util.Optional<NewTopicMirror> mirror)
Sets the mirror information for topic creation.
|
java.lang.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.
|
java.util.Map<java.lang.Integer,java.util.List<java.lang.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.
|
java.lang.String |
toString() |
public NewTopic(java.lang.String name, int numPartitions, short replicationFactor)
public NewTopic(java.lang.String name, java.util.Optional<java.lang.Integer> numPartitions, java.util.Optional<java.lang.Short> replicationFactor)
numPartitions
and replicationFactor
to
the broker configurations for num.partitions
and default.replication.factor
respectively.public NewTopic(java.lang.String name, java.util.Map<java.lang.Integer,java.util.List<java.lang.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 java.lang.String name()
public int numPartitions()
public short replicationFactor()
public java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> replicasAssignments()
public NewTopic configs(java.util.Map<java.lang.String,java.lang.String> configs)
configs
- The configuration map.public java.util.Map<java.lang.String,java.lang.String> configs()
public NewTopic mirror(java.util.Optional<NewTopicMirror> mirror)
public java.util.Optional<NewTopicMirror> mirror()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object