1 of 1 people found this helpful
I 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.
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 ?
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
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.