riedelmax commented on code in PR #14544: URL: https://github.com/apache/kafka/pull/14544#discussion_r1408365148
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -468,6 +468,52 @@ public List<ListGroupsResponseData.ListedGroup> listGroups(List<String> statesFi return groupStream.map(group -> group.asListedGroup(committedOffset)).collect(Collectors.toList()); } + + /** + * Handles a ConsumerGroupDescribe request. + * @param groupIds The IDs of the groups to describe. + * @param committedOffset A specified committed offset corresponding to this shard. + * + * @return A list containing the ConsumerGroupDescribeResponseData.DescribedGroup. + */ + public List<ConsumerGroupDescribeResponseData.DescribedGroup> consumerGroupDescribe( + List<String> groupIds, + long committedOffset + ) { + final List<ConsumerGroupDescribeResponseData.DescribedGroup> describedGroups = new ArrayList<>(); + groupIds.forEach(groupId -> { + try { + describedGroups.add(consumerGroup(groupId, committedOffset).asDescribedGroup(committedOffset, defaultAssignor.name())); + } catch (GroupIdNotFoundException exception) { + describedGroups.add(new ConsumerGroupDescribeResponseData.DescribedGroup() + .setGroupId(groupId) + .setGroupState(DEAD.toString()) + ); + } + }); + + return describedGroups; +// +// for (String groupId: groupIds) { +// Group group = groups.get(groupId, committedOffset); +// +// ConsumerGroupDescribeResponseData.DescribedGroup describedGroup = new ConsumerGroupDescribeResponseData.DescribedGroup() +// .setGroupId(groupId); +// +// if (group == null || !CONSUMER.equals(group.type())) { +// // We don't support upgrading/downgrading between protocols at the moment so +// // we set an error if a group exists with the wrong type. +// describedGroup.setErrorCode(Errors.GROUP_ID_NOT_FOUND.code()); +// } else { +// describedGroup = ((ConsumerGroup) group).asDescribedGroup(committedOffset, defaultAssignor.name()); +// } +// +// response.add(describedGroup); +// } +// +// return response; Review Comment: I will remove this and resolve the corresponding tests once the other discussion regarding group state DEAD is resolved. -- 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