Don't delay batch offset commits

When `idleBetweenPolls` was set, the sleep was done after invoking
the listener and before calling `pollAndInvoke()` again.

This delays committing the offsets for ack modes other than `RECORD`.

Move the sleep to after committing the offsets and before the next `poll()`.
This commit is contained in:
Gary Russell
2019-11-08 10:17:14 -05:00
committed by Artem Bilan
parent 1cd3ebfa3a
commit eccfb4c850

View File

@@ -888,7 +888,6 @@ public class KafkaMessageListenerContainer<K, V> // NOSONAR line count
while (isRunning()) {
try {
pollAndInvoke();
idleBetweenPollIfNecessary();
}
catch (@SuppressWarnings(UNUSED) WakeupException e) {
// Ignore, we're stopping or applying immediate foreign acks
@@ -929,6 +928,7 @@ public class KafkaMessageListenerContainer<K, V> // NOSONAR line count
if (!this.autoCommit && !this.isRecordAck) {
processCommits();
}
idleBetweenPollIfNecessary();
if (this.seeks.size() > 0) {
processSeeks();
}