|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkafka.common.Cluster
public final class Cluster
A representation of a subset of the nodes, topics, and partitions in the Kafka cluster.
Constructor Summary | |
---|---|
Cluster(java.util.Collection<Node> nodes,
java.util.Collection<PartitionInfo> partitions)
Create a new cluster with the given nodes and partitions |
Method Summary | |
---|---|
static Cluster |
bootstrap(java.util.List<java.net.InetSocketAddress> addresses)
Create a "bootstrap" cluster using the given list of host/ports |
static Cluster |
empty()
Create an empty cluster instance with no nodes and no topic-partitions. |
Node |
leaderFor(TopicPartition topicPartition)
Get the current leader for the given topic-partition |
Node |
nextNode()
Round-robin over the nodes in this cluster |
java.util.List<Node> |
nodes()
|
PartitionInfo |
partition(TopicPartition topicPartition)
Get the metadata for the specified partition |
java.util.List<PartitionInfo> |
partitionsFor(java.lang.String topic)
Get the list of partitions for this topic |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cluster(java.util.Collection<Node> nodes, java.util.Collection<PartitionInfo> partitions)
nodes
- The nodes in the clusterpartitions
- Information about a subset of the topic-partitions this cluster hostsMethod Detail |
---|
public static Cluster empty()
public static Cluster bootstrap(java.util.List<java.net.InetSocketAddress> addresses)
addresses
- The addresses
public java.util.List<Node> nodes()
public Node leaderFor(TopicPartition topicPartition)
topicPartition
- The topic and partition we want to know the leader for
public PartitionInfo partition(TopicPartition topicPartition)
topicPartition
- The topic and partition to fetch info for
public java.util.List<PartitionInfo> partitionsFor(java.lang.String topic)
topic
- The topic name
public Node nextNode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |