public class ClusterMetadataTopicsSnapshot extends Object implements TopicsMetadataSnapshot
TopicsMetadataSnapshot
that leverages the ZK-cluster provided Cluster
metadataModifier and Type | Class and Description |
---|---|
class |
ClusterMetadataTopicsSnapshot.ClusterMetadataPartitionSnapshot
An implementation of
TopicsMetadataSnapshot.PartitionSnapshot leveraging the ZK-cluster PartitionInfo . |
class |
ClusterMetadataTopicsSnapshot.ClusterMetadataReplicaInfo
An implementation of
TopicsMetadataSnapshot.ReplicaInfo leveraging UpdateMetadataRequestData.UpdateMetadataPartitionState . |
static interface |
ClusterMetadataTopicsSnapshot.PartitionInfoSupplier
A simple supplier interface to match
MetadataCache.getPartitionInfo(String, int) |
TopicsMetadataSnapshot.PartitionSnapshot, TopicsMetadataSnapshot.ReplicaInfo
Constructor and Description |
---|
ClusterMetadataTopicsSnapshot(org.apache.kafka.common.Cluster clusterMetadata,
ClusterMetadataTopicsSnapshot.PartitionInfoSupplier partitionInfoSupplier) |
Modifier and Type | Method and Description |
---|---|
Optional<TopicsMetadataSnapshot.ReplicaInfo> |
partitionInfoSnapshot(TopicsMetadataSnapshot.PartitionSnapshot partitionSnapshot)
Fetch extra info about a
TopicsMetadataSnapshot.PartitionSnapshot . |
List<List<TopicsMetadataSnapshot.PartitionSnapshot>> |
partitionsByTopic() |
public ClusterMetadataTopicsSnapshot(org.apache.kafka.common.Cluster clusterMetadata, ClusterMetadataTopicsSnapshot.PartitionInfoSupplier partitionInfoSupplier)
clusterMetadata
- the latest cluster metadatapartitionInfoSupplier
- a supplier of MetadataCache.getPartitionInfo(String, int)
public List<List<TopicsMetadataSnapshot.PartitionSnapshot>> partitionsByTopic()
partitionsByTopic
in interface TopicsMetadataSnapshot
TopicsMetadataSnapshot.PartitionSnapshot
s for a given topic.
To be efficient in terms of time complexity, it is suggested implementations compute this collection just once and expose a view of it.public Optional<TopicsMetadataSnapshot.ReplicaInfo> partitionInfoSnapshot(TopicsMetadataSnapshot.PartitionSnapshot partitionSnapshot)
TopicsMetadataSnapshot
TopicsMetadataSnapshot.PartitionSnapshot
.partitionInfoSnapshot
in interface TopicsMetadataSnapshot