Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
检查此处提供的答案(https://stackoverflow.com/a/34514526/6613150)后,我可以在消息处理之前拦截它。但是,我现在需要在使用@RabbitListener 注释的方法结束后获取它。
任何想法?
而是将建议添加MethodInterceptor到容器的建议链中。这样,您就可以访问Message监听器调用之前和之后(以及引发的任何异常的通知)。
MethodInterceptor
Message
try { // before (message is in invocation arguments) invocation.proceed(); // after } catch (Exception e) { ... throw e; } finally { ... }