adikou opened a new pull request, #22242: URL: https://github.com/apache/kafka/pull/22242
Introduce RebalanceConsumer, a restricted view of the Consumer passed to rebalance callbacks that exposes only operations safe during a rebalance (seek, commit, position, pause/resume, etc.) and is invalidated after the callback returns. Add two-argument variants to each ConsumerRebalanceListener callback that receive a RebalanceConsumer, with defaults delegating to the existing one-argument methods for backward compatibility. Add setConsumerRebalanceListener() to Consumer as the new way to register a listener, decoupling listener registration from subscription. Internally, ConsumerAwareRebalanceListener wraps the user listener and manages DelegatingRebalanceConsumer view lifecycle, with the Consumer reference provided at registration time. Deprecate the Optional<ConsumerRebalanceListener> subscribe() variants on SubscriptionState in favor of listenerless overloads plus setConsumerRebalanceListener(listener, consumer). The subscribe(topics, listener) overloads on Consumer are not yet annotated @deprecated to avoid -Werror across the repo to keep the diff minimal. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
