Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-2991

Improve collection type consistency in KafkaConsumer API

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The KafkaConsumer API has some annoying inconsistencies in the usage of collection types. For example, subscribe() takes a list, but subscription() returns a set. Similarly for assign() and assignment(). We also have pause() and resume() which annoyingly use a variable argument array, which means you have to copy the result of assignment() to an array if you want to pause all assigned partitions. We can solve these issues by adding the following variants:

      void subscribe(Collection<String> topics);
      void assign(Collection<TopicPartition> partitions);
      void pause(Collection<TopicPartition> partitions);
      void resume(Collection<TopicPartition> partitions);
      

      I'm not actually sure that there is any need for the generic Collection, so an alternative would be to just use Set.

        Attachments

          Activity

            People

            • Assignee:
              hachikuji Jason Gustafson
              Reporter:
              hachikuji Jason Gustafson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: