由自定义标头设置的 JMS 优先级
有没有办法根据自定义标头值对 JMS 代理中的消息进行优先级排序?
例如:“购买日期”。首先是最老的等等。
请指教。
Is there a way to prioritize the messages in the JMS broker according to a custom header value?
For Example: "purchase date". get oldest first etc.
Please advise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 JMS 标准的范围内无法做到这一点。它不支持这样的自定义路由规则。
然而,许多实现 JMS 的产品都支持某种基于规则的路由/优先级排序,因此您应该查看您的产品文档。
There is no way to do this within the boundaries of the JMS standard. It doesn't support custom routing rules like this.
However, many products that implement JMS support some kind of rules-based routing/prioritizing like this, so you should look into your products documentation.
您可能可以使用 Apache Camel 或 ServiceMix 之类的工具来根据消息中的任何内容操作 JMSPriority 标头。 ActiveMQ 内置了camel,我将从这里开始。
如果我们不谈论开源解决方案,Tibco BusinessWorks(不是粉丝)也应该可以工作。
我认为您不会直接在 JMSProvider 中找到它,这更像是 ESB/消息路由器之类的东西。
当然,在实际发送消息之前,您可以将业务规则应用到 JMSPriority 标头,然后再发送。注意:我认为 ActiveMQ 目前并不真正支持 JMSPriority 标头。
You can probably use something like Apache Camel or ServiceMix to manipulate the JMSPriority header based on anything in the message. ActiveMQ comes with camel built in, I'd start there.
If we aren't talking about opensource solutions Tibco BusinessWorks (not a fan) should also work.
I don't think you will find this in a JMSProvider directly, this is more of an ESB/message router sort of thing.
Of course, before you actually send the message you can apply your business rules to the JMSPriority header before you send it. Note: I don't think ActiveMQ actually supports the JMSPriority header at this point.