Hey,

sorry for late reply, but I am wondering why the new `RebalanceConsumer` interface would extend `AutoClosable`?

I don't think that `close()` would be a safe operation during a rebalance, and the goal of the KIP is explicitly to only expose safe operations.


-Matthias

On 5/29/26 10:38 PM, Aditya Kousik wrote:
Thanks Chia-Ping.

chia_00: I’ve updated the JavaDoc (I realised it was lacking more detail that I 
have in the actual PR). In this case, yes each invocation replaces the 
previously set object. The final value before the subsequent poll() will be the 
one to receive callbacks during rebalance events.

Thanks,
Aditya

On May 29, 2026, at 21:48, Chia-Ping Tsai <[email protected]> wrote:

hi Aditya

chia_00: What happens if a user calls setRebalanceListener(listener) multiple 
times? I assume the previous listener will be replaced. If so, could you please 
explicitly state this behavior in the Javadoc?

Best,
Chia-Ping

On 2026/04/01 15:16:36 Aditya Kousik wrote:
Hi all,

I'd like to start a discussion on KIP-1306: RebalanceHandler: Consumer-Aware 
Rebalance Callback.

https://cwiki.apache.org/confluence/display/KAFKA/KIP-1306%3A+RebalanceHandler%3A+Consumer-Aware+Rebalance+Callback

Spring Kafka, SmallRye, and Micronaut all pass the consumer into rebalance 
callbacks; the client doesn't. The standard workaround of constructor-injecting 
a full Consumer reference allows dangerous operations like poll() and close() 
inside a callback. This KIP proposes RebalanceHandler, with a 
RebalanceConsumerView that exposes only safe operations, making misuse a 
compile error.

Looking forward to your feedback.

Thanks


Reply via email to