dajac commented on code in PR #14640: URL: https://github.com/apache/kafka/pull/14640#discussion_r1422269556
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -177,34 +202,37 @@ public void process(final BackgroundEvent event) { case ERROR: process((ErrorBackgroundEvent) event); break; + case GROUP_METADATA_UPDATE: process((GroupMetadataUpdateEvent) event); break; + + case CONSUMER_REBALANCE_LISTENER_CALLBACK_NEEDED: + process((ConsumerRebalanceListenerCallbackNeededEvent) event); + break; + default: throw new IllegalArgumentException("Background event type " + event.type() + " was not expected"); } } - @Override - protected Class<BackgroundEvent> getEventClass() { - return BackgroundEvent.class; - } - private void process(final ErrorBackgroundEvent event) { throw event.error(); } private void process(final GroupMetadataUpdateEvent event) { - if (AsyncKafkaConsumer.this.groupMetadata.isPresent()) { - final ConsumerGroupMetadata currentGroupMetadata = AsyncKafkaConsumer.this.groupMetadata.get(); - AsyncKafkaConsumer.this.groupMetadata = Optional.of(new ConsumerGroupMetadata( - currentGroupMetadata.groupId(), - event.memberEpoch(), - event.memberId(), - currentGroupMetadata.groupInstanceId() - )); - } + updateConsumerGroupMetadata(event.memberId(), event.memberEpoch()); Review Comment: Should we revert this too? ########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -177,34 +202,37 @@ public void process(final BackgroundEvent event) { case ERROR: process((ErrorBackgroundEvent) event); break; + case GROUP_METADATA_UPDATE: process((GroupMetadataUpdateEvent) event); break; + + case CONSUMER_REBALANCE_LISTENER_CALLBACK_NEEDED: + process((ConsumerRebalanceListenerCallbackNeededEvent) event); + break; + default: throw new IllegalArgumentException("Background event type " + event.type() + " was not expected"); } } - @Override - protected Class<BackgroundEvent> getEventClass() { - return BackgroundEvent.class; - } - private void process(final ErrorBackgroundEvent event) { throw event.error(); } private void process(final GroupMetadataUpdateEvent event) { - if (AsyncKafkaConsumer.this.groupMetadata.isPresent()) { - final ConsumerGroupMetadata currentGroupMetadata = AsyncKafkaConsumer.this.groupMetadata.get(); - AsyncKafkaConsumer.this.groupMetadata = Optional.of(new ConsumerGroupMetadata( - currentGroupMetadata.groupId(), - event.memberEpoch(), - event.memberId(), - currentGroupMetadata.groupInstanceId() - )); - } + updateConsumerGroupMetadata(event.memberId(), event.memberEpoch()); + } + + private void process(final ConsumerRebalanceListenerCallbackNeededEvent event) { Review Comment: Do we have a unit test testing this new code in `AsyncKafkaConsumerTest`? I cannot find it. -- 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