Interface KafkaSubscriber

  • All Superinterfaces:
    Serializable

    @PublicEvolving
    public interface KafkaSubscriber
    extends Serializable
    Kafka consumer allows a few different ways to consume from the topics, including:
    1. Subscribe from a collection of topics.
    2. Subscribe to a topic pattern using Java Regex.
    3. Assign specific partitions.

    The KafkaSubscriber provides a unified interface for the Kafka source to support all these three types of subscribing mode.

    • Method Detail

      • getSubscribedTopicPartitions

        Set<org.apache.kafka.common.TopicPartition> getSubscribedTopicPartitions​(org.apache.kafka.clients.admin.AdminClient adminClient)
        Get a set of subscribed TopicPartitions.
        Parameters:
        adminClient - The admin client used to retrieve subscribed topic partitions.
        Returns:
        A set of subscribed TopicPartitions
      • getPartitionSetSubscriber

        static KafkaSubscriber getPartitionSetSubscriber​(Set<org.apache.kafka.common.TopicPartition> partitions)