使用过滤器来控制 HornetQ 集群中的消息传递?
由于业务需求,我正在使用 JMS 消息传递设置,其中:
- 队列必须由应用程序容器定义。
- 队列必须能够存在于集群中,并平衡负载。
- 应用程序必须允许客户端指定可以从此队列接收消息的集群节点的子集。
目前,每个节点都有相同的 hornetq 配置,并且每个节点都使用默认的广播设置进行通信。
阅读文档后,我想到也许可以在包含合法集群节点列表的消息上设置一个属性,然后按照“position(${currentNode}, LEGAL_NODES) != 0”的方式执行某些操作。到目前为止,我还没有取得太大的成功,主要是由于 hornetq 文档中的文档相当参差不齐。
有人解决过这样的问题吗?你是怎么做到的?
Due to business requirements, I'm working with a JMS messaging setup in which:
- Queues must be defined by the application container.
- Queues must be able to exist in a cluster, and balance load.
- The application must allow the client to specify a subset of cluster nodes that may receive messages from this queue.
Currently every node has an identical hornetq configuration, and each node communicates with the default broadcast setup.
After reading the documentation, I had the thought that I could perhaps set a property on the message that includes a list of legal cluster nodes, then do something along the lines of 'position(${currentNode}, LEGAL_NODES) != 0'. So far I haven't had much success, mostly due to fairly spotty documentation in the hornetq documentation.
Has anyone solved a problem like this? How did you do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终在每个队列上使用了这个选择器:
之后,我使用 Spring MessagePostProcessor 为每条消息设置 LEGAL_NODES 属性。
I ended up using this selector on each queue:
After that, I used a Spring MessagePostProcessor to set the LEGAL_NODES property for each message.