具有多个 URI 的 RabbitMQ 连接

标签 rabbitmq ssl amqp

同时

ConnectionFactory.newConnection(Address[] addrs)

因此

ConnectionFactory.newConnection(
  Address.parseAddresses("somehost.com:5672,otherhost.com:5672")) 

工作,我想知道是否有一种方法可以传递多个 URI,例如:

ConectionFactory.newConnection("amqps://somehost.com:5671,amqps://otherhost.com:5671")

或者为了允许每个 URI 可能使用不同的客户端证书,首先创建多个 ConnectionFactories,每个具有一个 URI,然后创建一个将这些连接工厂作为输入的 ConnectionFactory。

最佳答案

很确定这是不可能的。 http://www.rabbitmq.com/uri-spec.html

如果您正在尝试实现故障转移,您可能会考虑像心跳这样的东西:https://wiki.archlinux.org/index.php/Simple_IP_Failover_with_Heartbeat

如果您尝试从多个地方读取消息,您可以使用铲子 (http://www.rabbitmq.com/shovel.html) 将来自多个地方的这些消息放入一个队列中并从中读取。

关于具有多个 URI 的 RabbitMQ 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10282902/

相关文章:

linux - RabbitMQ - 使用 curl 从队列中获取消息

.net - 如何在 RabbitMQ 中设置重试次数?

php - 如何处理 Laravel 的 SMTP 驱动程序中的自签名 TLS 证书?

java - 连接被拒绝 : RabbitMQ

rabbitmq - 使用 RabbitMQ 进行选择性路由

spring-boot - Spring rabbit 重试传递被拒绝的消息..可以吗?

android - 如何使用 RabbitMQ 在两个 Android 应用程序之间发送消息

apache - 为 Apache SSL 使用多个 CA 证书

c# - 仅实现 Json 和 https 的 Wcf 服务

azure - 基于 TLS/SSL 的 AMQP 协议(protocol)