Is there any configuration to connect to queue with same name on different broker on failure?

霸气de小男生 提交于 2019-12-11 08:54:21

问题


I just want to know if there is configuration property in spring-amqp to auto connect to the hosts given in application property file which has same queue name!

For example, I have around 20 queues that will be used to publish and consume by around 10 small spring boot applications in a VM(server1) and if some things happens to queues/rabbitmq node on server1, then it should connect to same set of queues on server2 (whose host/addresses could be given application.property file - clustered/ non clustered nodes - all methods are fine for me). This could have been solved by Mirroring queue, but they involve performance degradation(transferring to other node and extra network trip by apps on other server whose nodes on which queues doesn't reside)

Not a great programmer now! Please ignore my ignorance! ;)


回答1:


What you are suggesting makes no sense, unless you are willing to lose messages and the queues are configured for auto-deletion.

If that's the case, it will "just work", simply use host1,host2 and, as long as the queues/bindings etc are configured as Spring @Beans, when the connection fails over, the queues will be declared on the new broker.

It doesn't make any sense for non-auto-delete queues since it is possible that messages still exist on the failed broker (and they will be consumed the next time we connect, but now there could be stale messages on the second broker).



来源:https://stackoverflow.com/questions/49967932/is-there-any-configuration-to-connect-to-queue-with-same-name-on-different-broke

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