org.apache.storm.kafka.spout.subscription

## Class NamedTopicFilter

- java.lang.Object
- - org.apache.storm.kafka.spout.subscription.NamedTopicFilter

- All Implemented Interfaces:
    Serializable, TopicFilter

      public class NamedTopicFilter
      extends Object
      implements TopicFilter

  Filter that returns all partitions for the specified topics.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NamedTopicFilter(Set<String> topics)` Create filter based on a set of topic names.
    `NamedTopicFilter(String... topics)` Convenience constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<org.apache.kafka.common.TopicPartition>` | `getAllSubscribedPartitions(org.apache.kafka.clients.consumer.Consumer<?,?> consumer)` Get the Kafka TopicPartitions subscribed to by this set of spouts.
    `String` | `getTopicsString()` Get the topics string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NamedTopicFilter

          public NamedTopicFilter(Set<String> topics)

      Create filter based on a set of topic names.

      Parameters:
        `topics` - The topic names the filter will pass.

    - #### NamedTopicFilter

          public NamedTopicFilter(String... topics)

      Convenience constructor.

      Parameters:
        `topics` - The topic names the filter will pass.

  - ### Method Detail

    - #### getAllSubscribedPartitions

          public Set<org.apache.kafka.common.TopicPartition> getAllSubscribedPartitions(org.apache.kafka.clients.consumer.Consumer<?,?> consumer)

      Description copied from interface: `TopicFilter`

      Get the Kafka TopicPartitions subscribed to by this set of spouts.

      Specified by:
        `getAllSubscribedPartitions` in interface `TopicFilter`
      Parameters:
        `consumer` - The Kafka consumer to use to read the list of existing partitions
      Returns:
        The Kafka partitions this set of spouts should subscribe to

    - #### getTopicsString

          public String getTopicsString()

      Description copied from interface: `TopicFilter`

      Get the topics string.

      Specified by:
        `getTopicsString` in interface `TopicFilter`
      Returns:
        A human-readable string representing the topics that pass the filter.

Copyright © 2021 The Apache Software Foundation. All rights reserved.