Spring AMQP Notification/Events on SimpleMessageListenerContainer, when queue gets deleted

微笑、不失礼 提交于 2019-12-13 01:29:34

问题


I have a scenario where I am consuming messages from queues using SimpleMessageListenerContainer. When any of these subscribed queues got deleted, I would like to get notification or events.

SimpleMessageListenerContainer simpleMessageListenerContainer
        = new SimpleMessageListenerContainer(cachingConnectionFactory);
simpleMessageListenerContainer.setQueueNames(
        "testQueue1","testQueue2","testQueue3");
simpleMessageListenerContainer.start();

回答1:


There is currently no event published when a consumer is cancelled due to a queue being deleted, aside from logging a WARN log.

Feel free to open an Improvement JIRA Issue and we'll see if we can get something into the upcoming 1.5 release.

In the meantime, you could possibly hook into your logging subsystem (e.g. configure a custom appender), or even one of the AMQP appenders provided by the framework for log4j and logback and have a consumer on the logger queue look for the consumer cancelled log.



来源:https://stackoverflow.com/questions/30988483/spring-amqp-notification-events-on-simplemessagelistenercontainer-when-queue-ge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!