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


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -420,6 +423,18 @@ public Group group(String groupId, long committedOffset) 
throws GroupIdNotFoundE
         return group;
     }
 
+    /**
+     * @return The GenericGroup List filtered by statesFilter or typesFilter.
+     */
+    public ListGroupsResponseData listGroups(ListGroupsRequestData request, 
long committedOffset) {
+        Stream<Group> groupStream = groups.values(committedOffset).stream();
+        List<String> statesFilter = request.statesFilter();
+        if (!statesFilter.isEmpty()) {
+            groupStream = groupStream.filter(group -> 
statesFilter.contains(group.stateAsString()));
+        }
+        return new 
ListGroupsResponseData().setGroups(groupStream.map(Group::asListedGroup).collect(Collectors.toList()));

Review Comment:
   done.



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