public class MetadataClient extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MetadataClient.Builder |
static class |
MetadataClient.ClusterAndGeneration |
static class |
MetadataClient.ClusterMetadata |
Modifier and Type | Method and Description |
---|---|
org.apache.kafka.common.Cluster |
cluster()
Get the current cluster.
|
MetadataClient.ClusterAndGeneration |
clusterAndGeneration()
Get the current cluster and generation
|
Optional<SbcClusterSnapshot> |
fetchSbcClusterSnapshot(Collection<String> topicNames)
Provides
SbcClusterSnapshot containing the latest snapshot of the topics and nodes in the cluster. |
MetadataClient.ClusterAndGeneration |
forceRefreshMetadata()
Force-refresh metadata, paying no attention to how recently it has been refreshed.
|
MetadataClient.ClusterAndGeneration |
forceRefreshMetadata(int timeoutMs)
Force-refresh metadata, paying no attention to how recently it has been refreshed,
and bound the wait time for the call.
|
MetadataClient.ClusterAndGeneration |
maybeRefreshMetadata()
Refresh the metadata.
|
MetadataClient.ClusterAndGeneration |
maybeRefreshMetadata(int timeoutMs)
Refresh the metadata, but bound the wait time for the call.
|
public MetadataClient.ClusterAndGeneration maybeRefreshMetadata()
public MetadataClient.ClusterAndGeneration forceRefreshMetadata(int timeoutMs)
timeoutMs
- bound for the wait timepublic MetadataClient.ClusterAndGeneration forceRefreshMetadata()
public MetadataClient.ClusterAndGeneration maybeRefreshMetadata(int timeoutMs)
timeoutMs
- bound for the wait timepublic Optional<SbcClusterSnapshot> fetchSbcClusterSnapshot(Collection<String> topicNames) throws InterruptedException
SbcClusterSnapshot
containing the latest snapshot of the topics and nodes in the cluster.
This is a blocking call.topicNames
- this is the list of topics of interest.SbcClusterSnapshot
if we manage to describe the cluster topics and nodes before the timeout controlled
with metadata.client.timeout.ms; otherwise, we return an empty response. Also, the result may not include all or any
of the requested topics if they don't longer exist in the cluster.InterruptedException
- whenever the thread executing the call is being interrupted.public MetadataClient.ClusterAndGeneration clusterAndGeneration()
public org.apache.kafka.common.Cluster cluster()