I don't fully understand how consumer error handling works with committing offset and akcMode and how it is affected by stopping containers on error (using spring-kafka 1.3.*).
Lets say I have two consumers (consuming two partitions), they both fetch 5 events from their partitions when polling (max.records.per.poll=5).
The first consumer - 1st event is processed OK, processing 2nd event fails - so in error handler I call kafkaListenerEndpointRegistry.stop(), but since stop is implemented that it just stop consumers from polling, both consumers still finish processing their current batches. So the first consumer processes events 3,4,5 (all of them processed without errors), and lets say that second consumer fails on 4th event (and events 1,2,3,5 were processed OK).
My question is what offsets will be commited for each consumer?
My understanding is:
- when I use
AckMode.RECORD/BATCHwith combination withackOnError- latest offsets will be committed for both consumers(5) - when I use
AckMode.RECORD/BATCHwith combination with!ackOnError- also latest offset will be committed for both consumer - because although some events failed during processing batch, latest processed events in the batches were ok, so latest processed event offset wins.
Is my understanding correct?