How to use Jms priority header field in JMS applications ?
How is it implemented by MOM ?
How will a consumer use this value ? If messages with different priorities are in a queue, what will be the result if a consuming application makes a simple call to get or receive or is listening on the queue (with MessageListener) ?
Is the result depending on the JMS provider implementation ?
To set the priority when sending a message, use the following message on MessageProducer:
void send(Message message, int deliveryMode, int priority, long timeToLive)
Sends a message to the destination, specifying delivery mode, priority, and time to live.
Alternatively you can set the default priority for a MessageProducer by calling
Note that the following method on Message is for a different purpose and hould not be used
void setJMSPriority(int priority)
The JMS 1.1 specification contains the following explanation of message priority.
JMS defines a ten-level priority value, with 0 as the lowest priority and 9 as the
highest. In addition, clients should consider priorities 0-4 as gradations of
normal priority and priorities 5-9 as gradations of expedited priority.
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.
18.104.22.168 Order of Message Sends
• Messages of higher priority may jump ahead of previous lower-priority messages.