Class TopicMetadataFetcher
java.lang.Object
org.apache.kafka.clients.consumer.internals.TopicMetadataFetcher
TopicMetadataFetcher is responsible for fetching the PartitionInfo for a given set of topics.
All methods are blocking up to the timeout provided.-
Constructor Summary
ConstructorsConstructorDescriptionTopicMetadataFetcher(org.apache.kafka.common.utils.LogContext logContext, ConsumerNetworkClient client, long retryBackoffMs, long retryBackoffMaxMs) -
Method Summary
Modifier and TypeMethodDescriptiongetAllTopicMetadata(org.apache.kafka.common.utils.Timer timer) Fetches thepartition informationfor all topics in the cluster.List<org.apache.kafka.common.PartitionInfo> getTopicMetadata(String topic, boolean allowAutoTopicCreation, org.apache.kafka.common.utils.Timer timer) Fetches thepartition informationfor the given topic in the cluster, ornull.
-
Constructor Details
-
TopicMetadataFetcher
public TopicMetadataFetcher(org.apache.kafka.common.utils.LogContext logContext, ConsumerNetworkClient client, long retryBackoffMs, long retryBackoffMaxMs)
-
-
Method Details
-
getTopicMetadata
public List<org.apache.kafka.common.PartitionInfo> getTopicMetadata(String topic, boolean allowAutoTopicCreation, org.apache.kafka.common.utils.Timer timer) Fetches thepartition informationfor the given topic in the cluster, ornull.- Parameters:
timer- Timer bounding how long this method can block- Returns:
- The
listofpartition information, ornullif the topic is unknown
-
getAllTopicMetadata
public Map<String,List<org.apache.kafka.common.PartitionInfo>> getAllTopicMetadata(org.apache.kafka.common.utils.Timer timer) Fetches thepartition informationfor all topics in the cluster.- Parameters:
timer- Timer bounding how long this method can block- Returns:
- The map of topics with their
partition information
-