java - ActiveMQ:如何平衡多个Message Broker实例之间的负载?

标签 java activemq messaging

刚刚浏览了这些文档:

  • http://activemq.apache.org/failover-transport-reference.html <--- 据我了解,故障转移允许生产者和消费者仅在第一个队列不可用时才生成/消费辅助队列,并在主队列再次返回时立即返回到主队列。这种行为绝对不是负载平衡。
  • http://activemq.apache.org/networks-of-brokers.html <--- 他们提供了一些如何在多个 Broker 实例之间复制消息的方法。如果其中一个发生故障,客户端可以自动故障转移到已拥有所有消息的从属服务器,因此每条消息都具有高可用性。但这也不是我所期待的。

那么,是否可以配置消费者和生产者应用程序来连接和平衡多个代理实例之间的负载(以循环或类似方式)?

最佳答案

这就是network of brokers在存储和转发模式中旨在执行... queues are distributed用于负载平衡(注意:这不是 HA,但是...如果代理发生故障,其消息将滞留在消息存储中,直到代理重新启动,需要主/从来实现 HA)

if we had broker A, B, C and a publisher on a queue on A. If we have consumers on the queue on A and B then messages for the queue will be spread across both brokers A and B; some messages going to B, some being consumed on A, none going to C. If a consumer on the queue starts on C, then messages will flow there too. If the consumer stops then no more messages will be dispatched to C.

关于java - ActiveMQ:如何平衡多个Message Broker实例之间的负载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20197871/

相关文章:

mysql - 如何根据可以在两列中的任意一列中的用户标识仅选择最近的记录?

针对不同模块的 Java 粒度调试消息

java - Android 7.1.3 的 iText 方法

xml - ActiveMQ 5.11.1 不断抛出EOFException 不发送消息

java - Spring Boot 中使用相同存储库和实体的多个数据源

jakarta-ee - 检查ActiveMQ代理的状态

python - 无法使用 STOMP 将消息发送到 activemq

java - Qpid Java 6.0.1 或 Qpid JMS 和 Qpid Proton

java - Hibernate:何时使用@Index 注释

java - 我的 Android 应用程序中的\\p{Punct} 行为