kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Cheng <wushuja...@gmail.com>
Subject Why does consumer.subscribe(Pattern) require a ConsumerRebalanceListener?
Date Wed, 04 Jan 2017 02:30:27 GMT
Hi,

I was looking at the docs for the consumer, and noticed that when calling subscribe() with
a regex Pattern, that you are required to pass in a ConsumerRebalanceListener. On the other
hand, when you use a fixed set of topic names (Collection<String>), the ConsumerRebalanceListener
is optional (that is, there is a subscribe(Collection<String>) that does not require
a ConsumerRebalanceListener)

http://kafka.apache.org/0101/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#subscribe(java.util.regex.Pattern,%20org.apache.kafka.clients.consumer.ConsumerRebalanceListener)
<http://kafka.apache.org/0101/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#subscribe(java.util.regex.Pattern,
org.apache.kafka.clients.consumer.ConsumerRebalanceListener)>

Why does the regex one require a rebalance listener, whereas the fixed-topic one does not?
Is it to force the user to think through what happens as new topic/partitions appear and disappear?

-James


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message