SpringSpring Kafka Advanced
What is spring.kafka.listener.ack-mode RECORD vs BATCH vs MANUAL?
Reference answer
The container's AckMode controls how often offsets are committed when enable.auto.commit is false (the framework sets it to false unless you set it explicitly). RECORD: commit the offset when the listener returns after processing each record. BATCH (the default): commit when all the records returned by the poll() have been processed. TIME: like BATCH but only if ackTime has passed since the last commit. COUNT: like BATCH but only if ackCount records have been received since the last commit. COUNT_TIME: commit when either the TIME or the COUNT condition is true. MANUAL: the listener must call Acknowledgment.acknowledge(), after which BATCH semantics apply. MANUAL_IMMEDIATE: commit immediately when acknowledge() is called. MANUAL and MANUAL_IMMEDIATE need an acknowledging listener (AcknowledgingMessageListener). Committing more often (RECORD) means more commit requests but fewer records reprocessed after a failure. When transactions are used, the offsets are sent to the transaction instead, with semantics equivalent to RECORD or BATCH. Use MANUAL or MANUAL_IMMEDIATE when your code must decide when an offset counts as processed.
Expected key concepts: RECORD, BATCH, MANUAL, MANUAL_IMMEDIATE, COUNT, TIME, COUNT_TIME, Acknowledgment.acknowledge, poll, enable.auto.commit, ackMode
How did that feel?
Your own verdict, not the score. It shows up next to this question in the list, so you can come back to the shaky ones.