If I have enable.auto.commit=false, and I call consumer.poll()without calling consumer.commitAsync()after, why does it consumer.poll()return new records on the next call?
Since I did not perform my offset, I would expect to poll()return the last offset, which should be the same records again.
I ask because I'm trying to process failure scenarios during my processing. I hoped, without committing the bias, poll()would return the same records again in order to repeat these failed records again.
public class MyConsumer implements Runnable {
@Override
public void run() {
while (true) {
ConsumerRecords<String, LogLine> records = consumer.poll(Long.MAX_VALUE);
for (ConsumerRecord record : records) {
try {
consumer.commitAsync();
} catch (Exception e) {
}
}
}
}
}
Glide source
share