9

From spring-docs, I can see

MANUAL - the message listener is responsible to acknowledge() the Acknowledgment; after which, the same semantics as BATCH are applied.

MANUAL_IMMEDIATE - commit the offset immediately when the Acknowledgment.acknowledge() method is called by the listener.

But what exactly is the difference if the listener is committing the offset. What additional steps are done for MANUAL mode

Community
  • 1
  • 1
Abbin Varghese
  • 2,422
  • 5
  • 28
  • 42

1 Answers1

11

MANUAL - acks are queued and the offsets committed in one operation when all the results from the last poll have been processed.

MANUAL_IMMEDIATE - the offset is committed immediately (sync or async) as long as the ack is performed on the listener thread.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • So, in spring-kafka, it can make a difference for the batch mode - by comiting the offset of individual records ? – Abbin Varghese Mar 30 '20 at 14:11
  • Not at all; the other way around; for a record listener, MANUAL commits the offsets at the end of the batch, MANUAL_IMMEDIATE commits them one-by-one. There's little difference for a batch listener (just a minor timing difference because we still go through the queue). – Gary Russell Mar 30 '20 at 14:14
  • 3
    However, with a batch listener and MANUAL_IMMEDIATE with syncCommits, you can catch the exception; with MANUAL, the error will send the batch to the error handler. – Gary Russell Mar 30 '20 at 14:17