-
1. Re: JMS message priority not working on Message
gaohoward Jul 22, 2011 5:57 AM (in response to riteshj2ee)1 of 1 people found this helpfulI think you need to use MessageProducer's method:
public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
to do it.
See the api doc:
JMS providers set this field when a message is sent. This method can be used to change the value for a message that has been received.
It says this method is used by JMS providers, or used on a received message.
Howard
-
2. Re: JMS message priority not working on Message
riteshj2ee Jul 22, 2011 6:08 AM (in response to gaohoward)Hi Yong,
Thanks for reply, that's correct I am doing in that way only,
but then what is the use or role of Message.setJMSPriority() method ?
-
3. Re: JMS message priority not working on Message
gaohoward Jul 22, 2011 7:51 AM (in response to riteshj2ee)Hi Ritesh,
I'm not sure about it. As far as I know this method is used internally in JMS provider to set the priority in sending. Looking at JMS spec, there is a paragraph that I think may be relevant to this method:
3.4.12 Overriding Message Header Fields
JMS permits an administrator to configure JMS to override the client-specified
values for JMSDeliveryMode, JMSExpiration and JMSPriority. If this is done, the
header field value must reflect the administratively specified value.
JMS does not define specifically how an administrator overrides these header
field values. A JMS provider is not required to support this administrative
option.
So I think it is possible for a JMS provider like hornetq to provide some admin interface to change the priority, and this method may be used for that purpose.