Spring Kafka DefaultErrorHandler ackAfterHandle = false behavaiour

Viewed 18

Would anyone know what is the implication of setting ackAfterHandle to false in Spring Kafka's DefaultErrorHandler?

Does it

  1. Essentially causes the application to be "stuck" and unable to move on to processing the next message, or
  2. Not commit the offset, but moves on to the offset after, which in essence skips the message that caused the error?

Intuitively, I would expect that if I set ackAfterHandle to false, it #1 is the expected behaviour, but my testing suggests it would #2 is a more accurate description of the behaviour.

If it is indeed #2, what is the point of ackAfterHandle given that regardless of whether it is true and false, in essence the error is discarded and subsequent messages processed?

Thanks!

1 Answers

#2; that is why it is true by default.

It doesn't make much sense to ever set it to false, but it is there for historical reasons (early versions of the framework never committed the offsets of "handled" error records).

To achieve #1 behavior use the CommonContainerStoppingErrorHandler.

Related