负载均衡MessageQ(ActiveMQ) [英] Load balancing MessageQ (ActiveMQ)

查看:124
本文介绍了负载均衡MessageQ(ActiveMQ)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况.

1)基于REST的Web服务(Say X)接受请求并将其放入ActiveQ 2)Q的另一侧有一个侦听器,该侦听器将读取和处理消息.这是异步的

1) A REST based web service (Say X) takes in requests and puts it into ActiveQ 2) There is a listener on the other side of the Q that will read and process the message. This is async

我决定使用ActiveMQ. 但是,试图找到一种可以让Q和Q侦听器可扩展的解决方案.

I decided to go with ActiveMQ. But trying to find a solution where I can Q and the Q listeners scalable.

1)我有很多X实例在运行.因此,Q有多个生产者. 2)点菜对我很重要. 3)由于我的REST服务的会话较少,因此我无法用相同的消息ID标记一堆请求. 4)现在,如果我使用单个Q,它将正常工作.

1) I have many instances of X running. Hence there are multiple prodders to the Q. 2) Ordering is important to me. 3) Since my REST service is session less, I don't have a way to tag a bunch of requests with the same message ID. 4) Now if I use a single Q, it works fine..

但是我想扩大规模并使用多个Q和多个Q使用者,而不影响订单.

But I want to scale it up and use multiple Q and multiple Q consumers without compromising on the order.

有人可以建议我解决这个问题吗?

Can someone suggest me a solution to this problem?

非常感谢

推荐答案

要实现消息排序,在activeMQ中定义了2种方法

To achieve ordering of messages there are 2 ways defined in activeMQ

1)基于JMSXGroupID的MessageGroups

1)MessageGroups based on JMSXGroupID

2)独家消费者

消息组比排他"使用者更有用,因为在内部排他"使用者一次仅使用一个使用者,但是在该使用者失败的情况下,它会连接到另一个使用者".

Message groups are more useful than Exclusive consumer,as internally Exclusive Consumer only uses one consumer at a time,but in case of that consumer failure it connects to other consumer.

您可以在此处阅读ActiveMQ文档

You can read the ActiveMQ documentation for the same here

希望这会有所帮助! 祝你好运!

hope this helps! Good luck!

这篇关于负载均衡MessageQ(ActiveMQ)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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