apoorvmittal10 commented on code in PR #19649:
URL: https://github.com/apache/kafka/pull/19649#discussion_r2075619503
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java:
##########
@@ -2047,6 +2047,48 @@ public void
testDeliveryCountDifferentBehaviorWhenClosingSessionWithExplicitAckn
}
}
+ @ClusterTest(
+ serverProperties = {
+ @ClusterConfigProperty(key = "group.share.delivery.count.limit",
value = "2"),
+ }
+ )
+ public void testBehaviorOnDeliveryCountBoundary() {
+ alterShareAutoOffsetReset("group1", "earliest");
+ try (Producer<byte[], byte[]> producer = createProducer();
+ ShareConsumer<byte[], byte[]> shareConsumer = createShareConsumer(
+ "group1",
+ Map.of(ConsumerConfig.SHARE_ACKNOWLEDGEMENT_MODE_CONFIG,
EXPLICIT))) {
+
+ ProducerRecord<byte[], byte[]> record = new
ProducerRecord<>(tp.topic(), tp.partition(), null,
+ "key".getBytes(), "value".getBytes());
+ producer.send(record);
+ producer.flush();
+
+ shareConsumer.subscribe(Set.of(tp.topic()));
+ ConsumerRecords<byte[], byte[]> records =
waitedPoll(shareConsumer, 2500L, 1);
+ assertEquals(1, records.count());
+ assertEquals((short) 1,
records.records(tp).get(0).deliveryCount().get());
+ // Acknowledge the record with AcknowledgeType.RELEASE.
+ shareConsumer.acknowledge(records.records(tp).get(0),
AcknowledgeType.RELEASE);
+ Map<TopicIdPartition, Optional<KafkaException>> result =
shareConsumer.commitSync();
+ assertEquals(1, result.size());
+
+ // Consume again, the delivery count should be 2.
+ records = waitedPoll(shareConsumer, 2500L, 1);
+ assertEquals(1, records.count());
+ assertEquals((short) 2,
records.records(tp).get(0).deliveryCount().get());
+
Review Comment:
nit: remove line break
--
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]