zhaohaidao commented on code in PR #14271:
URL: https://github.com/apache/kafka/pull/14271#discussion_r1318751801


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -420,6 +422,23 @@ public Group group(String groupId, long committedOffset) 
throws GroupIdNotFoundE
         return group;
     }
 
+    /**
+     * @return The GenericGroup List filtered by statesFilter and 
committedOffset.
+     */
+    public List<ListGroupsResponseData.ListedGroup> listGroups(List<String> 
statesFilter, long committedOffset) {
+        Stream<Group> groupStream = groups.values(committedOffset).stream();
+        if (!statesFilter.isEmpty()) {
+            groupStream = groupStream.filter(group -> {
+                if (group instanceof ConsumerGroup) {
+                    return statesFilter.contains(((ConsumerGroup) 
group).stateAsString(committedOffset));
+                } else {
+                    return statesFilter.contains(group.stateAsString());
+                }

Review Comment:
   make sense. 



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