Class KafkaUtils

java.lang.Object
io.confluent.security.store.kafka.clients.KafkaUtils

public class KafkaUtils extends Object
  • 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 for
      numPartitions - Expected number of partitions
      time - Instance of time used for timeout
      timeout - Timeout duration
      describeTopic - 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 timeout
      org.apache.kafka.common.KafkaException - if describe or create fails with an non-retriable exception