Priority with activemq

≯℡__Kan透↙ 提交于 2019-12-05 08:07:38

If my opinion you are not missing anything, I had a similar issue a couple of weeks ago (but with TTL and QPid).

First the JMS is not Strict about this :

JMS does not require that a provider strictly implement priority ordering of messages; however, it should do its best to deliver expedited messages ahead of normal messages.

Second, ActiveMQ does not YET implement priority queues, they say it will somewhere in 6.x version.

So, what you see is actually normal.

As a work-around you can use the Resequencer pattern if it fits your case.

http://camel.apache.org/resequencer.html

Here is another discussion on this subject:

http://activemq.2283324.n4.nabble.com/Priority-message-td2352179.html

I know it is late but this answers may help somebody.

If you want your consumer to consume message based on priority (Priority Queue) then you can use client side message priority. This means, when messages are being sent to your consumer (even before your consumer is receiving them, using prefetch), they will be cached on the consumer side and prioritized by default. This is regardless of whether you’re using priority support on the broker side. This could impact the ordering you see on the consumer so just keep this in mind.

To enable it, set the following configuration option on your broker URL, e.g.,

tcp://0.0.0.0:61616?jms.messagePrioritySupported=true

To disable it, tcp://0.0.0.0:61616?jms.messagePrioritySupported=false

So you do not require to use Camel (if you want to avoid complication)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!