[jboss-user] [JBoss Messaging] - Re: Message priority does not seem to work
do-not-reply at jboss.com
Thu Feb 7 04:51:54 EST 2008
I haven't run your code but I had a quick look at it. A couple of observations
1) As already mentioned. JMSPriority set on a message is ignored - you need to set it on the producer (as per JMS spec)
2) JBM (and pretty much every other messaging system) buffers messages on the client side.
So basically you have the normal JMS queue on the server, and each consumer keeps a local buffer of messages on the client side to itself and consumes from that. This is is done for performance reasons (it is much quicker than fetching a message every time from the server).
The server side queue is ordered by priority and also the client side buffer is ordered by priority.
In your case, you are sending messages faster than you can consume them, so your client side buffer becomes full. So any higher priority messages sent after that won't make it to the client side until you consume your buffer.
Since your consumers are so slow, you probably don't really need to buffer so you can set this to 1 (prefetchSize- see userguide). This should improve what you see.
Also bear in mind that message priorities are a "best effort", there is no guarantee in any JMS system that they will be strictly observed (JMS Spec 3.4.10).
In fact it's almost impossible to do this when you have buffer in action.
Any reliance on strict ordering of messages will make your app non portable as well.
Hope that helps.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127294#4127294
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127294
More information about the jboss-user