Home > Enterprise >  Opportunity to catch, log, and rethrow exception when an exception occurs in kafka listener containe
Opportunity to catch, log, and rethrow exception when an exception occurs in kafka listener containe

Time:10-04

I want to catch an exception that occurs within kafka listener container, log some attributes from the exception, then rethrow the exception. What is the best way to do this without modifying the existing error handling flow?

CodePudding user response:

Add a MethodInterceptor to the container's adviceChain.

https://docs.spring.io/spring-kafka/docs/current/reference/html/#adviceChain

  • Related