kirktrue commented on code in PR #14640:
URL: https://github.com/apache/kafka/pull/14640#discussion_r1423245926


##########
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:
   I added a parameterized test for completeness. It covers the case of 
including a `ConsumerRebalanceListener` and making sure that `Consumer.poll()` 
invokes the listener methods as intended. It doesn't go as deep as testing the 
back and forth with the membership manager, which are covered in the 
integration tests.



-- 
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

Reply via email to