lucasbru commented on code in PR #20574:
URL: https://github.com/apache/kafka/pull/20574#discussion_r2378492322
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/StreamsTopology.java:
##########
@@ -95,4 +97,43 @@ public static StreamsTopology
fromHeartbeatRequest(StreamsGroupHeartbeatRequestD
.collect(Collectors.toMap(StreamsGroupTopologyValue.Subtopology::subtopologyId,
x -> x));
return new StreamsTopology(topology.epoch(), subtopologyMap);
}
+
+ public StreamsGroupDescribeResponseData.Topology
asStreamsGroupDescribeTopology() {
+ return new StreamsGroupDescribeResponseData.Topology()
+ .setEpoch(topologyEpoch)
+ .setSubtopologies(
+ subtopologies.entrySet().stream()
+ .sorted(Map.Entry.comparingByKey())
+ .map(entry ->
asStreamsGroupDescribeSubtopology(entry.getKey(), entry.getValue()))
+ .toList()
+ );
+ }
+
+ private StreamsGroupDescribeResponseData.Subtopology
asStreamsGroupDescribeSubtopology(String subtopologyId,
StreamsGroupTopologyValue.Subtopology subtopology) {
+ return new StreamsGroupDescribeResponseData.Subtopology()
+ .setSubtopologyId(subtopologyId)
+
.setSourceTopics(subtopology.sourceTopics().stream().sorted().toList())
+
.setRepartitionSinkTopics(subtopology.repartitionSinkTopics().stream().sorted().toList())
+
.setRepartitionSourceTopics(subtopology.repartitionSourceTopics().stream()
+ .map(this::asStreamsGroupDescribeTopicInfo)
+
.sorted(Comparator.comparing(StreamsGroupDescribeResponseData.TopicInfo::name)).toList())
+
.setStateChangelogTopics(subtopology.stateChangelogTopics().stream()
+ .map(this::asStreamsGroupDescribeTopicInfo)
+
.sorted(Comparator.comparing(StreamsGroupDescribeResponseData.TopicInfo::name)).toList());
+ }
+
+ private StreamsGroupDescribeResponseData.TopicInfo
asStreamsGroupDescribeTopicInfo(StreamsGroupTopologyValue.TopicInfo topicInfo) {
+ return new StreamsGroupDescribeResponseData.TopicInfo()
+ .setName(topicInfo.name())
+ .setPartitions(topicInfo.partitions())
+ .setReplicationFactor(topicInfo.replicationFactor())
+ .setTopicConfigs(
+ topicInfo.topicConfigs().stream().map(
+ y -> new StreamsGroupDescribeResponseData.KeyValue()
Review Comment:
Done
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/StreamsGroup.java:
##########
@@ -1039,7 +1039,16 @@ public StreamsGroupDescribeResponseData.DescribedGroup
asDescribedGroup(
.setGroupEpoch(groupEpoch.get(committedOffset))
.setGroupState(state.get(committedOffset).toString())
.setAssignmentEpoch(targetAssignmentEpoch.get(committedOffset))
-
.setTopology(configuredTopology.get(committedOffset).map(ConfiguredTopology::asStreamsGroupDescribeTopology).orElse(null));
+ .setTopology(
+ configuredTopology.get(committedOffset)
+ .filter(ConfiguredTopology::isReady)
+ .map(ConfiguredTopology::asStreamsGroupDescribeTopology)
+ .orElse(
+ topology.get(committedOffset)
+
.map(StreamsTopology::asStreamsGroupDescribeTopology)
+ .orElse(null)
Review Comment:
Okay, fine.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]