Skip to content

Commit 5a0b23e

Browse files
authored
Fix messages waiting for empty topic (#60)
1 parent b60f2a3 commit 5a0b23e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ public void emit(FluxSink<ConsumerRecord<Bytes, Bytes>> sink) {
6868
assignPartitions(consumer);
6969
seekOffsets(consumer);
7070
int pollsCount = 0;
71-
while (!sink.isCancelled() || ++pollsCount > MAX_POLLS_COUNT) {
71+
while (!sink.isCancelled() && ++pollsCount < MAX_POLLS_COUNT) {
7272
ConsumerRecords<Bytes, Bytes> records = consumer.poll(POLL_TIMEOUT_MS);
7373
log.info("{} records polled", records.count());
7474
records.iterator()
7575
.forEachRemaining(sink::next);
7676
}
77+
sink.complete();
7778
} catch (Exception e) {
7879
log.error("Error occurred while consuming records", e);
7980
throw new RuntimeException(e);

0 commit comments

Comments
 (0)