Do not wait for a full batch if there's no messages in the topic (#77)
This commit is contained in:
parent
4ed5f2dd10
commit
5ad3f5ce79
1 changed files with 3 additions and 0 deletions
|
@ -107,6 +107,9 @@ public class ConsumingService {
|
||||||
while (!sink.isCancelled() && ++pollsCount < MAX_POLLS_COUNT) {
|
while (!sink.isCancelled() && ++pollsCount < MAX_POLLS_COUNT) {
|
||||||
ConsumerRecords<Bytes, Bytes> records = consumer.poll(POLL_TIMEOUT_MS);
|
ConsumerRecords<Bytes, Bytes> records = consumer.poll(POLL_TIMEOUT_MS);
|
||||||
log.info("{} records polled", records.count());
|
log.info("{} records polled", records.count());
|
||||||
|
if (records.count() == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
records.iterator()
|
records.iterator()
|
||||||
.forEachRemaining(sink::next);
|
.forEachRemaining(sink::next);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue