General J2EE: Prioritizing the messages in JMS and MDB
- Posted by: singaravela nalendran
- Posted on: August 26 2004 12:49 EDT
Can we prioritize the messages in JMS queue. My application needs to process one set of messages quickly tha the other messages. Even if there are 1000 messages in the queue when a high priority message comes in to the queue the Message Driven Bean should process it first. How can I prioritize such a thing in JMS. Is this feature supported. How do I go about ??
Yes. You can give priorities to your messages.
Every JMS message contains a standard set of header fields that is included by default and available to message consumers. Some fields can be set by the message producers.
Specifies the priority level. This field is set before a message is sent.
JMS defines ten priority levels, 0 to 9, 0 being the lowest priority. Levels 0-4 indicate gradations of normal priority, and level 5-9 indicate gradations of expedited priority.
When the message is received, it contains the value specified by the method sending the message.
I am not sure what app server you are using.. In case if it's BEA..check
Thank you vaheesan selvarajah. It was quite useful.
Foe prioritizing if we just set the JMSPriority like below is it fine or we should also create some destination Keys. How to link the destination keys with the messages. It is not clear in the e-docs of weblogic.
//after initialising queue session