This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have the following situation on a queue. I have posted 6 messages with priority 0 and 6 with priority 5. All of them have attribute JMS_JBOSS_SCHEDULED_DELIVERY set with the same timestamp. I attach extract from JMX Console below:
Given this situation, I would expect all priority 5 messages to be delivered first, and then all priority 0s. What actually happens is that JBoss delivers first one priority 0 message, then all priority 5 and then all other priority 0s. Does anybody understand why?
My best guess is that the JMS-handler actually finds time to send the first 0-message while the rest of the 0 and 5 messages are handled. But that is a wild guess.
What happens if you "zebra-send" the messages? (5,0,5,0,5,0,5,0...) Shouldn't matter.
Joined: Feb 08, 2010
Thanks for your reply Ove,
What do you mean exactly? with "the JMS-handler actually finds time to send the first 0-message"? they are not sent immediately, in that case I would understand this behaviour... they are all postponed to a specific time (let's say 17:00) which is identical for all messages. From the monitor you can see that all messages are scheduled for exactly the same time... I have the impression that JBoss delivers the first one and only AFTER the first one applies priority, but of course I could be wrong...
"What happens if you "zebra-send" the messages? (5,0,5,0,5,0,5,0...) Shouldn't matter."
This way works but 0,5,0,5... etc still presents the same problem as 0 is the first one stored in the queue...
In JMS the message priority property is not an absolute rule to follow but more an indication for the JMS provider to process the messages.
The JMS provider will try to process the message by priority by it is not guaranted.