FrankYang0529 commented on code in PR #16449:
URL: https://github.com/apache/kafka/pull/16449#discussion_r1667597763


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java:
##########
@@ -213,14 +217,16 @@ private void process(final SubscriptionChangeEvent 
ignored) {
      *              the group is sent out.
      */
     private void process(final UnsubscribeEvent event) {
-        if (!requestManagers.heartbeatRequestManager.isPresent()) {
-            KafkaException error = new KafkaException("Group membership 
manager not present when processing an unsubscribe event");
-            event.future().completeExceptionally(error);
-            return;
+        if (requestManagers.heartbeatRequestManager.isPresent()) {
+            MembershipManager membershipManager = 
requestManagers.heartbeatRequestManager.get().membershipManager();
+            CompletableFuture<Void> future = membershipManager.leaveGroup();
+            future.whenComplete(complete(event.future()));
+        } else {
+            // If the group membership manager is not present, we can't send 
the leave group request,

Review Comment:
   Update the comment. Thank you.



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