Shekharrajak commented on code in PR #22357:
URL: https://github.com/apache/kafka/pull/22357#discussion_r3430483702
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTransactionTest.java:
##########
@@ -111,6 +111,78 @@ public void testTransactionalShareAckCommitAccept() throws
Exception {
}
}
+ @ClusterTest
+ public void testTransactionalShareAckCommitAcrossMultiplePolls() throws
Exception {
Review Comment:
This test is to validate if user using multiple polls like :
```
try (ShareConsumer<byte[], byte[]> consumer = new
KafkaShareConsumer<>(consumerProps);
Producer<byte[], byte[]> producer = new
KafkaProducer<>(producerProps)) {
producer.initTransactions();
consumer.subscribe(Set.of("input-topic"));
producer.beginTransaction();
ConsumerRecords<byte[], byte[]> firstPoll =
consumer.poll(Duration.ofSeconds(1));
for (ConsumerRecord<byte[], byte[]> record : firstPoll) {
consumer.acknowledge(record, AcknowledgeType.ACCEPT);
}
ShareGroupMetadata metadata = consumer.shareGroupMetadata();
ShareAcknowledgements firstAcks =
consumer.acknowledgementsForTransaction();
producer.sendShareAcknowledgementsToTransaction(firstAcks, metadata);
ConsumerRecords<byte[], byte[]> secondPoll =
consumer.poll(Duration.ofSeconds(1));
for (ConsumerRecord<byte[], byte[]> record : secondPoll) {
// More work
consumer.acknowledge(record, AcknowledgeType.ACCEPT);
}
ShareAcknowledgements secondAcks =
consumer.acknowledgementsForTransaction();
producer.sendShareAcknowledgementsToTransaction(secondAcks, metadata);
producer.commitTransaction();
}
```
--
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]