dajac commented on code in PR #15152: URL: https://github.com/apache/kafka/pull/15152#discussion_r1467689455
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -452,21 +453,38 @@ public Group group(String groupId, long committedOffset) throws GroupIdNotFoundE /** * Get the Group List. * - * @param statesFilter The states of the groups we want to list. - * If empty all groups are returned with their state. - * @param committedOffset A specified committed offset corresponding to this shard + * @param statesFilter The states of the groups we want to list. + * If empty, all groups are returned with their state. + * @param typesFilter The types of the groups we want to list. + * If empty, all groups are returned with their type. + * @param committedOffset A specified committed offset corresponding to this shard. * * @return A list containing the ListGroupsResponseData.ListedGroup */ + public List<ListGroupsResponseData.ListedGroup> listGroups( + Set<String> statesFilter, + Set<String> typesFilter, + long committedOffset + ) { + // Converts each string to a value in the GroupType enum while being case-insensitive. + Set<Group.GroupType> enumTypesFilter = typesFilter.stream() + .map(Group.GroupType::parse) + .collect(Collectors.toSet()); Review Comment: > In the consumerGroupCommand tool we return an illegalArgumentException if the type is unknown so I thought maybe it would make sense to do that here as well. Yeah, the context is a bit different here. You have to think about how illegalArgumentException will get returned to the user. The Kafka protocol does not have any error for this so it converts it to a Unknown Server Error without any details. This is not great from a user perspective. I think that the correct way would be to try parsing the received group type. If it succeeds, great, we keep it. Otherwise, we simply discard it. If you want to keep the illegalArgumentException, you could catch it when you call `parse`. -- 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