Spring-kafka 2.7.4 - producing lots of logs when deserialization failed #1911
-
We recently upgraded to Spring-kafka 2.7.4 and Spring boot: 2.5.3 to use @RetryableTopic. Listener:
Configuration:
Whenever i put an invalid JSON the listener is producing lots of logs even though i have ErrorHandlingDeserializer configured. It is writing a huge junk string to the Dead letter topic and i think the Dead letter topic listener is producing lots of logs afterwards
Am i missing something in the configuration? Please help |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
By default, if you have a We need to look at making that conditional on the exception type; clearly a deserialization exception will never succeed. In the meantime, you can set the strategy to See https://docs.spring.io/spring-kafka/docs/current/reference/html/#dlt-failure-behavior Or, instead of configuring a cc/ @tomazfernandes |
Beta Was this translation helpful? Give feedback.
-
Hello, sorry for the delay @garyrussell, I saw you had solved @vivekkamineni's issue. Yeah, I think we could look into making the DLT retrial conditional on the exception type, specially because a deserialization exception can happen due to an external change and we do not want to get stuck in an infinite loop because of that. Adding the exclusion to the one exception should be easy enough, OTOH if we're to let the user choose the exceptions to be retried we'd need to figure out a clean API. DYT we should open an enhancement issue for that? I probably wouldn't be able to work on that anytime soon, but hopefully you or someone from the community can. I'm glad @vivekkamineni's problem got resolved, thanks! |
Beta Was this translation helpful? Give feedback.
By default, if you have a
@DltHandler
, it will retry failures forever.We need to look at making that conditional on the exception type; clearly a deserialization exception will never succeed.
In the meantime, you can set the strategy to
FAIL_ON_ERROR
.See https://docs.spring.io/spring-kafka/docs/current/reference/html/#dlt-failure-behavior
Or, instead of configuring a
@DltHandler
, configure your own listener to consume from the DLT - by the default, theSeekToCurrentErrorHandler
will not retryDeserializationException
.cc/ @tomazfernandes