Class KafkaUtils
java.lang.Object
io.confluent.security.store.kafka.clients.KafkaUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidwaitForTopic(String topic, int numPartitions, org.apache.kafka.common.utils.Time time, Duration timeout, Function<String, Set<Integer>> describeTopic, Consumer<String> createTopic) Waits for full partition metadata for topic with `numPartitions` partitions to be available.
-
Constructor Details
-
KafkaUtils
public KafkaUtils()
-
-
Method Details
-
waitForTopic
public static void waitForTopic(String topic, int numPartitions, org.apache.kafka.common.utils.Time time, Duration timeout, Function<String, Set<Integer>> describeTopic, Consumer<String> createTopic) Waits for full partition metadata for topic with `numPartitions` partitions to be available. This method handles edge cases where partial metadata for a topic may be available on the broker.- Parameters:
topic- Name of topic to wait fornumPartitions- Expected number of partitionstime- Instance of time used for timeouttimeout- Timeout durationdescribeTopic- Topic describe function that returns set of partitions returned from a metadata request. Returned set may be empty.createTopic- Function used to create topic. If null, topic is not created and this method just waits for topic to be available.- Throws:
IllegalStateException- if the actual number of partitions exceeds `numPartitions`org.apache.kafka.common.errors.TimeoutException- if partition metadata for all of `numPartitions` partitions are not available within timeoutorg.apache.kafka.common.KafkaException- if describe or create fails with an non-retriable exception
-