chia7712 commented on code in PR #18198:
URL: https://github.com/apache/kafka/pull/18198#discussion_r4172427792
##########
tools/src/test/java/org/apache/kafka/tools/consumer/ConsoleConsumerTest.java:
##########
@@ -411,6 +418,34 @@ public void
testGroupMetadataMessageFormatter(ClusterInstance cluster) throws Ex
}
}
+ @ClusterTest(serverProperties = {
+ @ClusterConfigProperty(key = OFFSETS_TOPIC_PARTITIONS_CONFIG, value =
"1"),
+ @ClusterConfigProperty(key = OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG,
value = "1")
+ })
+ public void
testGroupMetadataMessageFormatterWithConsumerGroupProtocol(ClusterInstance
cluster) throws Exception {
+ cluster.createTopic(topic, 1, (short) 1);
+ produceMessages(cluster);
+
+ String[] groupMetadataMessageFormatter =
createConsoleConsumerArgs(cluster,
+ Topic.GROUP_METADATA_TOPIC_NAME,
+ "org.apache.kafka.tools.consumer.GroupMetadataMessageFormatter");
+
+ ConsoleConsumerOptions options = new
ConsoleConsumerOptions(groupMetadataMessageFormatter);
+ ConsoleConsumer.ConsumerWrapper consumerWrapper =
+ new ConsoleConsumer.ConsumerWrapper(options,
createGroupMetadataConsumer(cluster, GroupProtocol.CONSUMER));
+
+ try (ByteArrayOutputStream out = new ByteArrayOutputStream();
+ PrintStream output = new PrintStream(out)) {
+ ConsoleConsumer.process(1, options.formatter(), consumerWrapper,
output, true);
+
+ JsonNode jsonNode =
objectMapper.reader().readTree(out.toByteArray());
+ // Consumer group protocol does not write GROUP_METADATA records,
so the result is empty
Review Comment:
This is confusing at first glance. Please update the comment to explain that
we don't have a formatter to read the records written by the CONSUMER protocol.
BTW, we have a ticket for the new formatter:
https://issues.apache.org/jira/browse/KAFKA-19277
@dajac Do you have time to address KAFKA-19277? Or I could ask another
contributor to take it over :)
--
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]