-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Expected Behavior
Allow to extend or configure DefaultErrorHandler
(which use FixedBackOff.UNLIMITED_ATTEMPTS
) in such way that if "Retrying Complete Batches" happen (see spring-kafka documentation) then it is possible to log transient error.
Current Behavior
Spring-kafka logs error only if reties are exhausted. If applications have to retry forever in case of transient error (for example some external application is not available but is needed to process each message) then no errors are logged at all.
There are two solutions for that problem:
- catch, log and re-throw errors in method annotated with
@KafkaListener
, - extend
DefaultErrorHandler
and log errors inside of overwritten methods.
The second method works perfectly except when "Retrying Complete Batches" takes place. In this case DefaultErrorHandler methods are not called at all.
Context
This issue stops my team from upgrading from spring-kafka 2.7.* to 2.8.*.
I would prefer to use second solution described above without using fist solution.
I did not find any alternatives to achieve same goal.
The only workaround I found is to use second method and log non-BatchListenerFailedException errors in method annotated with @KafkaListener
.