Apache ActiveMQ Artemis 集群中的消息顺序 [英] Message Order in Apache ActiveMQ Artemis Cluster

查看:80
本文介绍了Apache ActiveMQ Artemis 集群中的消息顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Apache Artemis 集群中实现消息排序.连接到集群的生产者/消费者实现高可用性.因此,在某一时刻,同一应用程序的两个实例将连接到主题或队列.到目前为止,我可以找到以下两种方法可以用于在 Red Hat AMQ/Artemis 集群中实现排序:

I am trying to implement message ordering in Apache Artemis cluster. Producers/Consumers connecting to the cluster implement High availability. So at one point of time there will be two instances of same application connecting to topic or queue. So far, I could find following two methods which can be used to achieve ordering in Red Hat AMQ / Artemis cluster:

  1. 消息组(仅当集群中的每个节点有一个消费者时才可靠)
  2. 独占队列(消息顺序仅保留在单个节点上).

我完全理解使用集群和期望消息排序是相互冲突的要求,但它仍然是我正在从事的项目中实现的要求,因为消费者无法处理处理乱序消息的复杂性.

I fully understand using cluster and expecting message ordering are conflicting requirements, but its still a requirement to be implemented in the project I am working on as the consumers are unable to handle the complexity of handling out of order messages.

在 Artemis ActiveMQ/Red Hat AMQ 集群中,除了上述方法之外,还有哪些可以实现消息排序的替代方案?

What are the alternatives to the above that can be used to implement message ordering in Artemis ActiveMQ / Red Hat AMQ Cluster?

推荐答案

在集群环境中,每个代理上的每个队列都绑定了一个独占消费者,因此根据消息负载平衡配置,您可以为每个代理接收一个消费者消息.这打破了秩序.您的生产者和消费者需要位于同一个代理实例上以保持排序.

In a clustered environment an exclusive consumer is tied to each queue on each broker, so depending on the message load balancing configuration, you could have one consumer per broker receiving messages. This breaks ordering. Your producer and consumers need to be on the same broker instance to preserve ordering.

如您所说,集群消息组功能并不可靠,但它在某些非常特定的用例中可能很有用.另请注意,对于 HA 而言,拥有一组代理是不够的.您需要明确配置 HA(共享存储或复制),否则,如果代理永久失败,则其所有消息都将丢失.

As you say, clustered message groups functionality is not reliable, nevertheless it may be useful in some, very specific use cases. Also note that, for HA it's not sufficient to have a cluster of brokers. You need to explicitly configure HA (shared-store or replication), otherwise, if a broker fails permanently, then all its messages would be lost.

这篇关于Apache ActiveMQ Artemis 集群中的消息顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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