是否有任何配置可以在失败时连接到不同代理上的同名队列? [英] Is there any configuration to connect to queue with same name on different broker on failure?

查看:36
本文介绍了是否有任何配置可以在失败时连接到不同代理上的同名队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想知道 spring-amqp 中是否有配置属性可以自动连接到具有相同队列名称的应用程序属性文件中给出的主机!

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!

例如,我有大约 20 个队列将用于在 VM(server1)中由大约 10 个小型 Spring Boot 应用程序发布和使用,如果 server1 上的 queues/rabbitmq 节点发生某些事情,那么它应该连接到server2 上的同一组队列(可以为主机/地址提供 application.property 文件 - 集群/非集群节点 - 所有方法对我来说都很好).这本来可以通过 镜像 队列解决,但它们涉及性能下降(转移到其他节点和其他服务器上的应用程序的额外网络行程,其节点不驻留在队列中)

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! ;)

推荐答案

你的建议毫无意义,除非你愿意丢失消息并且队列被配置为自动删除.

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

如果是这种情况,它将正常工作",只需使用 host1,host2 并且,只要队列/绑定等配置为 Spring @Beans,当连接发生故障时,队列将在新代理上声明.

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).

这篇关于是否有任何配置可以在失败时连接到不同代理上的同名队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆