cadonna commented on code in PR #19421: URL: https://github.com/apache/kafka/pull/19421#discussion_r2037577517
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -180,6 +186,25 @@ public class AsyncKafkaConsumer<K, V> implements ConsumerDelegate<K, V> { */ private class BackgroundEventProcessor implements EventProcessor<BackgroundEvent> { + private Optional<StreamsRebalanceListener> streamsGroupRebalanceCallbacks = Optional.empty(); + private final Optional<StreamsRebalanceData> streamsRebalanceData; + + public BackgroundEventProcessor() { + this.streamsRebalanceData = Optional.empty(); + } + + public BackgroundEventProcessor(final Optional<StreamsRebalanceData> streamsRebalanceData) { + this.streamsRebalanceData = streamsRebalanceData; + } + + private void setStreamsRebalanceListener(final StreamsRebalanceListener streamsRebalanceListener) { Review Comment: I understand your concern, but unfortunately it is not possible. The listener needs to read and write the state of the stream thread. However, the stream thread is not yet constructed when the Kafka consumer (and consequently also the background event processor) is constructed. IMO, passing the Streams rebalance listener in `subscribe()` is at least consistent with how it is done for the consumer rebalance listener. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org