adikou commented on code in PR #24241:
URL: https://github.com/apache/kafka/pull/24241#discussion_r4669859725
##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -754,6 +754,35 @@ public void
shouldIgnoreGroupInstanceIdForEmptyGroupId(GroupProtocol groupProtoc
consumer = newConsumer(config, new ByteArrayDeserializer(), new
ByteArrayDeserializer());
}
+ @ParameterizedTest
+ @EnumSource(GroupProtocol.class)
+ @SuppressWarnings("unchecked")
+ public void testRebalanceListenerRegisteredWithoutGroupId(GroupProtocol
groupProtocol) {
+ ConsumerMetadata metadata = createMetadata(subscription);
+ MockClient client = new MockClient(time, metadata);
+ initMetadata(client, Map.of(topic, 1));
+
+ consumer = newConsumer(groupProtocol, time, client, subscription,
metadata, assignor, false, null, groupInstanceId, false);
+ MockRebalanceListener listener = new MockRebalanceListener();
+ consumer.setRebalanceListener(listener);
+
+ consumer.assign(Set.of(tp0));
+ consumer.seekToBeginning(Set.of(tp0));
+ client.prepareResponse(listOffsetsResponse(Map.of(tp0, 50L)));
+ client.prepareResponse(fetchResponse(tp0, 50L, 5));
+
+ // Without a group.id the consumer can only use manual assignment, and
it still fetches records.
+ ConsumerRecords<String, String> records = (ConsumerRecords<String,
String>) consumer.poll(Duration.ofMillis(1));
Review Comment:
Almost makes me want to think we should have a non-generic Consumer/Producer
and leave it as bytes by default and have a memoized key/value setter/getter as
a method type generic. Everything but poll/send on Consumer/Producer is
immaterial to `<K, V>`. JSON/Proto/Avro that share the same field types but
different names and class types can't be (de)serialized anyway but method level
generic can. Most of the frameworks keep the type as `Consumer<byte[], byte[]>`
and deserialize at the last moment anyway.
--
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]