How do we hook into before/After message processing using @RabbitListener

后端 未结 2 1457
死守一世寂寞
死守一世寂寞 2021-01-02 01:46

Problem: I am migrating from MessageListener interface impl to @RabbitListener. I had logic like this where I was doing \"pre\" and \"post\" message process

2条回答
  •  温柔的废话
    2021-01-02 02:43

    Correction

    You can use the advice chain in the SimpleRabbitListenerContainerFactory to apply an around advice to listeners created for @RabbitListener; the two arguments are the Channel and Message.

    If you only need to take action before calling the listener, you can add MessagePostProcessor(s) to the container afterReceivePostProcessors.

提交回复
热议问题