Package io.vertx.kafka.client.common
Class PartitionInfo
- java.lang.Object
-
- io.vertx.kafka.client.common.PartitionInfo
-
public class PartitionInfo extends Object
Information about a specific Kafka topic partition
-
-
Constructor Summary
Constructors Constructor Description PartitionInfo()
ConstructorPartitionInfo(JsonObject json)
Constructor (from JSON representation)PartitionInfo(List<Node> inSyncReplicas, Node leader, int partition, List<Node> replicas, String topic)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Node>
getInSyncReplicas()
Node
getLeader()
int
getPartition()
List<Node>
getReplicas()
String
getTopic()
PartitionInfo
setInSyncReplicas(List<Node> inSyncReplicas)
Set the subset of the replicas that are in syncPartitionInfo
setLeader(Node leader)
Set the node id of the node currently acting as a leaderPartitionInfo
setPartition(int partition)
Set the partition idPartitionInfo
setReplicas(List<Node> replicas)
Set the complete set of replicas for this partitionPartitionInfo
setTopic(String topic)
Set the topic nameJsonObject
toJson()
Convert object to JSON representationString
toString()
-
-
-
Constructor Detail
-
PartitionInfo
public PartitionInfo()
Constructor
-
PartitionInfo
public PartitionInfo(List<Node> inSyncReplicas, Node leader, int partition, List<Node> replicas, String topic)
Constructor- Parameters:
inSyncReplicas
- the subset of the replicas that are in syncleader
- the node id of the node currently acting as a leaderpartition
- the partition idreplicas
- the complete set of replicas for this partitiontopic
- the topic name
-
PartitionInfo
public PartitionInfo(JsonObject json)
Constructor (from JSON representation)- Parameters:
json
- JSON representation
-
-
Method Detail
-
getInSyncReplicas
public List<Node> getInSyncReplicas()
- Returns:
- the subset of the replicas that are in sync, that is caught-up to the leader and ready to take over as leader if the leader should fail
-
setInSyncReplicas
public PartitionInfo setInSyncReplicas(List<Node> inSyncReplicas)
Set the subset of the replicas that are in sync- Parameters:
inSyncReplicas
- the subset of the replicas that are in sync- Returns:
- current instance of the class to be fluent
-
getLeader
public Node getLeader()
- Returns:
- the node id of the node currently acting as a leader for this partition or null if there is no leader
-
setLeader
public PartitionInfo setLeader(Node leader)
Set the node id of the node currently acting as a leader- Parameters:
leader
- the node id of the node currently acting as a leader- Returns:
- current instance of the class to be fluent
-
getPartition
public int getPartition()
- Returns:
- the partition id
-
setPartition
public PartitionInfo setPartition(int partition)
Set the partition id- Parameters:
partition
- the partition id- Returns:
- current instance of the class to be fluent
-
getReplicas
public List<Node> getReplicas()
- Returns:
- the complete set of replicas for this partition regardless of whether they are alive or up-to-date
-
setReplicas
public PartitionInfo setReplicas(List<Node> replicas)
Set the complete set of replicas for this partition- Parameters:
replicas
- the complete set of replicas for this partition- Returns:
- current instance of the class to be fluent
-
getTopic
public String getTopic()
- Returns:
- the topic name
-
setTopic
public PartitionInfo setTopic(String topic)
Set the topic name- Parameters:
topic
- the topic name- Returns:
- current instance of the class to be fluent
-
toJson
public JsonObject toJson()
Convert object to JSON representation- Returns:
- JSON representation
-
-