Class ApacheKafkaAdminAdapter

    • Method Detail

      • createTopic

        public void createTopic​(PubSubTopic pubSubTopic,
                                int numPartitions,
                                int replicationFactor,
                                PubSubTopicConfiguration pubSubTopicConfiguration)
        Creates a new topic in the PubSub system with the given parameters.
        Specified by:
        createTopic in interface PubSubAdminAdapter
        Parameters:
        pubSubTopic - The topic to be created.
        numPartitions - The number of partitions to be created for the topic.
        replicationFactor - The number of replicas for each partition.
        pubSubTopicConfiguration - Additional topic configuration such as retention, compaction policy, etc.
        Throws:
        java.lang.IllegalArgumentException - If the replication factor is invalid.
        PubSubTopicExistsException - If a topic with the same name already exists.
        PubSubClientRetriableException - If the operation failed due to a retriable error.
        PubSubClientException - For all other issues related to the PubSub client.
      • getTopicConfig

        public PubSubTopicConfiguration getTopicConfig​(PubSubTopic pubSubTopic)
        Retrieves the configuration of a Kafka topic.
        Specified by:
        getTopicConfig in interface PubSubAdminAdapter
        Parameters:
        pubSubTopic - The PubSubTopic representing the Kafka topic for which to retrieve the configuration.
        Returns:
        The configuration of the specified Kafka topic as a PubSubTopicConfiguration object.
        Throws:
        PubSubTopicDoesNotExistException - If the specified Kafka topic does not exist.
        PubSubClientRetriableException - If a retriable error occurs while attempting to retrieve the configuration.
        PubSubClientException - If an error occurs while attempting to retrieve the configuration or if the current thread is interrupted while attempting to retrieve the configuration.
      • listAllTopics

        public java.util.Set<PubSubTopic> listAllTopics()
        Retrieves a set of all available PubSub topics from the Kafka cluster.
        Specified by:
        listAllTopics in interface PubSubAdminAdapter
        Returns:
        A Set of PubSubTopic objects representing all available Kafka topics.
        Throws:
        PubSubClientRetriableException - If a retriable error occurs while attempting to retrieve the list of topics.
        PubSubClientException - If an error occurs while attempting to retrieve the list of topics or the current thread is interrupted while attempting to retrieve the list of topics.
      • containsTopic

        public boolean containsTopic​(PubSubTopic pubSubTopic)
        Checks if a Kafka topic exists.
        Specified by:
        containsTopic in interface PubSubAdminAdapter
        Parameters:
        pubSubTopic - The PubSubTopic to check for existence.
        Returns:
        true if the specified Kafka topic exists, false otherwise.
        Throws:
        PubSubClientRetriableException - If a retriable error occurs while attempting to check topic existence.
        PubSubClientException - If an error occurs while attempting to check topic existence.
      • containsTopicWithPartitionCheck

        public boolean containsTopicWithPartitionCheck​(PubSubTopicPartition pubSubTopicPartition)
        Checks if a topic exists and has the given partition
        Specified by:
        containsTopicWithPartitionCheck in interface PubSubAdminAdapter
        Parameters:
        pubSubTopicPartition - The PubSubTopicPartition representing the Kafka topic and partition to check.
        Returns:
        true if the specified Kafka topic partition exists, false otherwise.
        Throws:
        PubSubClientRetriableException - If a retriable error occurs while attempting to check partition existence.
        PubSubClientException - If an error occurs while attempting to check partition existence or of the current thread is interrupted while attempting to check partition existence.
      • getSomeTopicConfigs

        public java.util.Map<PubSubTopic,​PubSubTopicConfiguration> getSomeTopicConfigs​(java.util.Set<PubSubTopic> pubSubTopics)
        Retrieves the configurations for a set of Kafka topics.
        Specified by:
        getSomeTopicConfigs in interface PubSubAdminAdapter
        Parameters:
        pubSubTopics - The set of Kafka topics to retrieve configurations for.
        Returns:
        A map of Kafka topics and their corresponding configurations.
        Throws:
        PubSubClientRetriableException - If a retriable error occurs while attempting to retrieve configurations.
        PubSubClientException - If an error occurs while attempting to retrieve configurations or if the current thread is interrupted while attempting to retrieve configurations.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException