Class AdminClientUtils


  • public class AdminClientUtils
    extends Object
    • Constructor Detail

      • AdminClientUtils

        public AdminClientUtils()
    • Method Detail

      • newAdminClient

        public static org.apache.kafka.clients.admin.AdminClient newAdminClient​(Conf config)
        Creates a new AdminClient instance.
        Parameters:
        config - the client admin configuration.
        Returns:
        the new AdminClient instance.
      • waitForTopicToExist

        public static void waitForTopicToExist​(org.apache.kafka.clients.admin.AdminClient client,
                                               Set<String> topics)
                                        throws InterruptedException,
                                               TimeoutException
        Wait indefinitely for the specified topics to be created on the cluster.
        Parameters:
        client - the AdminClient instance to be used.
        topics - the list of topics name to be verified.
        Throws:
        InterruptedException - while waiting for response from broker.
        TimeoutException
      • waitForTopicToExist

        public static void waitForTopicToExist​(org.apache.kafka.clients.admin.AdminClient client,
                                               Set<String> topics,
                                               Duration timeout)
                                        throws InterruptedException,
                                               TimeoutException
        Wait for the specified topics to be created on the cluster until timeout.
        Parameters:
        client - the AdminClient instance to be used.
        topics - the list of topics name to be verified.
        Throws:
        InterruptedException - while waiting for response from broker.
        TimeoutException
      • listTopics

        public static CompletableFuture<Collection<org.apache.kafka.clients.admin.TopicListing>> listTopics​(org.apache.kafka.clients.admin.AdminClient client)