Browse Source

Do not wait for a full batch if there's no messages in the topic (#77)

Anton Petrov 5 years ago
parent
commit
5ad3f5ce79

+ 3 - 0
kafka-ui-api/src/main/java/com/provectus/kafka/ui/cluster/service/ConsumingService.java

@@ -107,6 +107,9 @@ public class ConsumingService {
 				while (!sink.isCancelled() && ++pollsCount < MAX_POLLS_COUNT) {
 					ConsumerRecords<Bytes, Bytes> records = consumer.poll(POLL_TIMEOUT_MS);
 					log.info("{} records polled", records.count());
+					if (records.count() == 0) {
+						break;
+					}
 					records.iterator()
 							.forEachRemaining(sink::next);
 				}