You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I throw an exception in the Kafka listener code, so messages will fail and this error handler will be used. The recoverer will try to publish the messages to dead letter topic. The emoji (😃) is a non-existing topic, so publishing of messages also fail with the following message: InvalidTopicException: Invalid topics: [😃]. Everything good so far.
The problem is that I now have an infinite loop.
Answer on another post (https://stackoverflow.com/a/76528357/6113915) suggests setting deadLetterPublishingRecoverer.setFailIfSendResultIsError(false);. This seemingly works, locally I can see logs with error level and the infinite loop stops. What makes me question this solution is the docstring
Set to true to enable waiting for the send result and throw an exception if it fails. It will wait for the milliseconds specified in waitForSendResultTimeout for the result
I do want to wait for the send result, because it is crucial that I find out about failures from DeadLetterPublishingRecoverer. To me the text reads like I should use the default true. So is setFailIfSendResultIsError(false) enough to guarantee that errors are logged, or is more code needed?
The above is the question copied from Stack Overflow. I also did some reading of the source code which I described in an answer on SO. I didn't come up with a solution, so the question remains the same:
How can I ensure exception in DeadLetterPublishingRecoverer is logged without entering an infinite loop?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I asked the question on Stack Overflow yesterday (link), so I hope it is okay to post the same question here:
Not sure how to handle exceptions in DeadLetterPublishingRecoverer. I have the following kafka listener error handler
I throw an exception in the Kafka listener code, so messages will fail and this error handler will be used. The recoverer will try to publish the messages to dead letter topic. The emoji (😃) is a non-existing topic, so publishing of messages also fail with the following message:
InvalidTopicException: Invalid topics: [😃]
. Everything good so far.The problem is that I now have an infinite loop.
Answer on another post (https://stackoverflow.com/a/76528357/6113915) suggests setting
deadLetterPublishingRecoverer.setFailIfSendResultIsError(false);
. This seemingly works, locally I can see logs with error level and the infinite loop stops. What makes me question this solution is the docstringI do want to wait for the send result, because it is crucial that I find out about failures from DeadLetterPublishingRecoverer. To me the text reads like I should use the default
true
. So issetFailIfSendResultIsError(false)
enough to guarantee that errors are logged, or is more code needed?The above is the question copied from Stack Overflow. I also did some reading of the source code which I described in an answer on SO. I didn't come up with a solution, so the question remains the same:
How can I ensure exception in DeadLetterPublishingRecoverer is logged without entering an infinite loop?
Beta Was this translation helpful? Give feedback.
All reactions