Status
Current state: Draft
Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]
JIRA: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Request: provide subscribe(Pattern pattern) overload, similar to subscribe(Collection<String> topics),
Today, for a consumer to subscribe to topics based on a regular expression (i.e. Pattern), the only method option also requires to pass in a ConsumerRebalanceListener. This is not user-friendly to require this second argument. It seems new NoOpConsumerRebalanceListener() has to be used.
Use case: multi datacenter, allowing easier subscription to multiple topics prefixed with datacenter names, just by using a pattern subscription.
Public Interfaces
The org.apache.kafka.clients.consumer.KafkaConsumer class will have a new method overload: subscribe(Pattern pattern)
Proposed Changes
The org.apache.kafka.clients.consumer.KafkaConsumer class should have a new method overload: subscribe(Pattern pattern) that calls subscribe(Pattern pattern, ConsumerRebalanceListener listener) with new NoOpConsumerRebalanceListener() as the second argument.
Compatibility, Deprecation, and Migration Plan
- No breaking change is expected.
- No migration is mandatory.
- No existing behavior will be deprecated or removed.
Rejected Alternatives
n/a