On Thu, 2010-12-23 at 09:50 -0800, rliguori wrote:
> "Did you set the priority on the MessageProducer ?"
> >> No, I set the priority of the individual messages.  Example:
> >> message.setJMSPriority(9);  Why would I set the priority on the producer,
> >> please provide an example and explain, if you don't mind.

>From JMS Spec on Message setPriority:

"Sets the priority level for this message.

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."

So you can see this method is only applicable after you receive a
message, not when its sent.

The producer is the one that sets the priority on each Message when the
send method is called.

>From MessageProducer JMS API for setPriority

"Sets the producer's default priority.

The JMS API defines ten levels of priority value, with 0 as the lowest
priority and 9 as the highest. Clients should consider priorities 0-4 as
gradations of normal priority and priorities 5-9 as gradations of
expedited priority. Priority is set to 4 by default."

Or you can do it on each Message send via the five argument send method
in MessageProducer:

"public void send(Destination destination,
                 Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException

    Sends a message to a destination for an unidentified message
producer, specifying delivery mode, priority and time to live.

    Typically, a message producer is assigned a destination at creation
time; however, the JMS API also supports unidentified message producers,
which require that the destination be supplied every time a message is
sent.

    Parameters:
        destination - the destination to send this message to
        message - the message to send
        deliveryMode - the delivery mode to use
        priority - the priority for this message
        timeToLive - the message's lifetime (in milliseconds)
"

Regards



-- 
Tim Bish
------------
FuseSource
Email: tim.b...@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/


Reply via email to