cadonna commented on code in PR #14879:
URL: https://github.com/apache/kafka/pull/14879#discussion_r1412360413


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -849,9 +953,22 @@ public OptionalLong currentLag(TopicPartition 
topicPartition) {
         }
     }
 
+    public void setGroupMetadata(final ConsumerGroupMetadata groupMetadata) {
+        this.groupMetadata = Optional.of(groupMetadata);
+    }
+
     @Override
     public ConsumerGroupMetadata groupMetadata() {
-        throw new KafkaException("method not implemented");
+        acquireAndEnsureOpen();
+        try {
+            maybeThrowInvalidGroupIdException();
+            backgroundEventProcessor.process();
+            return groupMetadata.orElseThrow(
+                () -> new IllegalStateException("No group metadata found 
although a valid group ID exists. This is a bug!")

Review Comment:
   Actually, `backgroundEventProcessor.process();` sets the group metadata. So 
returning group metadata from `maybeThrowInvalidGroupIdException` might return 
an outdated group metadata. Since now I removed 
`backgroundEventProcessor.process();`. I will reconsider the exception.



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