riedelmax commented on code in PR #14544: URL: https://github.com/apache/kafka/pull/14544#discussion_r1358491232
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -444,6 +445,43 @@ public List<ListGroupsResponseData.ListedGroup> listGroups(List<String> statesFi return groupStream.map(group -> group.asListedGroup(committedOffset)).collect(Collectors.toList()); } + + public List<ConsumerGroupDescribeResponseData.DescribedGroup> consumerGroupDescribe( + List<String> groupIds + ) { + List<ConsumerGroupDescribeResponseData.DescribedGroup> response = new ArrayList<>(); + + for (String groupId: groupIds) { + Group group = groups.get(groupId); + + 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.setErrorMessage(Errors.INVALID_GROUP_ID.message()); + describedGroup.setErrorCode(Errors.INVALID_GROUP_ID.code()); + } else { + ConsumerGroup consumerGroup = (ConsumerGroup) group; + describedGroup.setGroupState(consumerGroup.stateAsString()) + .setGroupEpoch(consumerGroup.groupEpoch()) + .setAssignmentEpoch(consumerGroup.assignmentEpoch()) + .setAssignorName( + consumerGroup.preferredServerAssignor().isPresent() ? + consumerGroup.preferredServerAssignor().get() : null Review Comment: Is it correct to set the preferredServerAssignor here and just null if it is not present? -- 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