lianetm commented on code in PR #14557:
URL: https://github.com/apache/kafka/pull/14557#discussion_r1425984924


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/MembershipManagerImpl.java:
##########
@@ -1077,4 +1131,18 @@ public void onUpdate(ClusterResource clusterResource) {
             reconcile();
         }
     }
+
+    /**
+     * Register a new listener that will be invoked whenever the member state 
changes, or a new
+     * member ID or epoch is received.
+     *
+     * @param listener Listener to invoke.
+     */
+    @Override
+    public void registerStateListener(MemberStateListener listener) {
+        if (listener == null) {
+            throw new IllegalArgumentException("State updates listener cannot 
be null");
+        }
+        this.stateUpdatesListeners.add(listener);
+    }

Review Comment:
   Agree on YAGNI. It's mainly to let the commit mgr access the latest member 
id/epoch from the state machine, avoiding a circular dependency, and ensuring 
that the state machine is the only one updating those and passing them on 
read-only. 



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