Skip to content

Commit

Permalink
Adding NoSuchElementException
Browse files Browse the repository at this point in the history
  • Loading branch information
biswassri committed Aug 22, 2022
1 parent 9f40e25 commit 4250431
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,12 @@ public boolean hasNext() {
}

@Override
public ConsumerRecords<byte[], byte[]> next() throws NoSuchElementException {
public ConsumerRecords<byte[], byte[]> next() {
var records = consumer.poll(Duration.ofMillis(100));
int pollSize = records.count();
emptyPoll = pollSize == 0;
recordsConsumed.addAndGet(pollSize);
if (emptyPoll) { throw new NoSuchElementException(); }
if (log.isTraceEnabled()) {
log.tracef("next() consumed records: %d; total %s", pollSize, recordsConsumed.get());
}
Expand Down

0 comments on commit 4250431

Please sign in to comment.