|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.kafka.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 |
java.util.List<Node> |
nodes()
|
PartitionInfo |
partition(TopicPartition topicPartition)
Get the metadata for the specified partition |
java.util.List<PartitionInfo> |
partitionsForNode(int nodeId)
Get the list of partitions whose leader is this node |
java.util.List<PartitionInfo> |
partitionsForTopic(java.lang.String topic)
Get the list of partitions for this topic |
java.util.Set<java.lang.String> |
topics()
Get all topics. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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> partitionsForTopic(java.lang.String topic)
topic
- The topic name
public java.util.List<PartitionInfo> partitionsForNode(int nodeId)
nodeId
- The node id
public java.util.Set<java.lang.String> topics()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |