apoorvmittal10 commented on code in PR #19789:
URL: https://github.com/apache/kafka/pull/19789#discussion_r2104111224
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java:
##########
@@ -2977,6 +2984,28 @@ private ConsumerRecords<byte[], byte[]> waitedPoll(
return waitedPoll(shareConsumer, pollMs, recordCount, false, "",
List.of());
}
+ private List<ConsumerRecord<byte[], byte[]>>
waitedPollMultipleRecords(ShareConsumer<byte[], byte[]> shareConsumer,
+ long
pollMs,
+ int
recordCount) {
Review Comment:
nit: needs indentation correction.
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java:
##########
@@ -2977,6 +2984,28 @@ private ConsumerRecords<byte[], byte[]> waitedPoll(
return waitedPoll(shareConsumer, pollMs, recordCount, false, "",
List.of());
}
+ private List<ConsumerRecord<byte[], byte[]>>
waitedPollMultipleRecords(ShareConsumer<byte[], byte[]> shareConsumer,
+ long
pollMs,
+ int
recordCount) {
+ List<ConsumerRecord<byte[], byte[]>> records = new ArrayList<>();
+ try {
+ waitForCondition(() -> {
+ ConsumerRecords<byte[], byte[]> recs =
shareConsumer.poll(Duration.ofMillis(pollMs));
+ for (ConsumerRecord<byte[], byte[]> record : recs) {
+ records.add(record);
+ }
+ return records.size() == recordCount;
+ },
+ DEFAULT_MAX_WAIT_MS,
+ 500L,
+ () -> "failed to get records"
Review Comment:
Shall we log how many records recieved vs needed? It will be easier to debug
in future?
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java:
##########
@@ -2977,6 +2984,28 @@ private ConsumerRecords<byte[], byte[]> waitedPoll(
return waitedPoll(shareConsumer, pollMs, recordCount, false, "",
List.of());
}
+ private List<ConsumerRecord<byte[], byte[]>>
waitedPollMultipleRecords(ShareConsumer<byte[], byte[]> shareConsumer,
Review Comment:
```suggestion
private List<ConsumerRecord<byte[], byte[]>>
waitedPollForMultipleRecords(ShareConsumer<byte[], byte[]> shareConsumer,
```
--
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]