Class TopicsCompanion


  • public class TopicsCompanion
    extends Object
    Companion for Topics operations on Kafka broker
    • Constructor Detail

      • TopicsCompanion

        public TopicsCompanion​(org.apache.kafka.clients.admin.AdminClient adminClient,
                               Duration kafkaApiTimeout)
    • Method Detail

      • create

        public void create​(Collection<org.apache.kafka.clients.admin.NewTopic> newTopics)
        Parameters:
        newTopics - the set of NewTopics to create
      • create

        public void create​(Map<String,​Integer> topicPartitions)
        Parameters:
        topicPartitions - the map of topic names to partition counts to create
      • create

        public void create​(String topic,
                           int partition)
        Create topic
        Parameters:
        topic - the topic name
        partition - the partition count
      • createAndWait

        public String createAndWait​(String topic,
                                    int partition)
        Create topic and wait for creation
        Parameters:
        topic - the topic name
        partition - the partition count
        Returns:
        the name of the created topic
      • createAndWait

        public org.apache.kafka.clients.admin.TopicDescription createAndWait​(String topic,
                                                                             int partition,
                                                                             Duration timeout)
        Create topic and wait for creation
        Parameters:
        topic - the topic name
        partition - the partition count
        timeout - timeout for topic to be created
        Returns:
        the description of the created topic
      • waitForTopic

        public io.smallrye.mutiny.Uni<org.apache.kafka.clients.admin.TopicDescription> waitForTopic​(String topic)
        Wait for topic
        Parameters:
        topic - name
        Returns:
        the Uni of the TopicDescription for the created topic
      • list

        public Set<String> list()
        Returns:
        the set of topic names
      • describeAll

        public Map<String,​org.apache.kafka.clients.admin.TopicDescription> describeAll()
        Returns:
        the map of topic names to topic descriptions
      • describe

        public Map<String,​org.apache.kafka.clients.admin.TopicDescription> describe​(String... topics)
        Parameters:
        topics - topics to describe
        Returns:
        the map of topic names to topic descriptions
      • clear

        public void clear​(String... topics)
        Deletes records from given topics
        Parameters:
        topics - the topic names to clear
      • delete

        public void delete​(Collection<String> topics)
        Parameters:
        topics - the collection of topic names to delete
      • delete

        public void delete​(String... topics)
        Parameters:
        topics - the topic names to delete