W3C home > Mailing lists > Public > public-soap-jms@w3.org > November 2010

Re: JMS header properties example code

From: Eric Johnson <eric@tibco.com>
Date: Tue, 23 Nov 2010 14:07:26 -0800
Message-ID: <4CEC3B1E.6050603@tibco.com>
To: Andrew Kennedy <grkvlt@apache.org>
CC: Andrew Kennedy <andrewinternational@gmail.com>, public-soap-jms@w3.org
Hi Andrew,

Thanks for noticing that!

I've logged this as http://www.w3.org/2002/ws/soapjms/tracker/issues/68

-Eric

On 11/21/10 5:12 PM, Andrew Kennedy wrote:
> Hi.
>
> I was looking at the latest SOAP over JMS specification draft and in 
> particular the description of setting JMS header (or QoS) properties, 
> with example code:
>
>     
> http://www.w3.org/TR/2010/WD-soapjms-20101026/#binding-header-props-xmp
>
> The example code given in section 2.2.2.1 "Setting JMS Message Header 
> properties" will not work as described. These properties on a message 
> can only be set by a JMS provider, and are basically read-only as far 
> as clients are concerned. To send a message using non-default QoS 
> values you need to use the four-argument send method, as shown in the 
> final (commented out) line of the example. A corrected example would 
> therefore use a method looking something like this:
>
> // add appropriate error checking for your use....
> public void someMethod(Context ctx, MessageProducer producer, Message 
> jmsMessage,
>         String deliveryModeStr, String replyToName, int priority, long 
> timeToLive) {
>
>     // set the delivery mode to the appropriate constant value.
>     int deliveryMode = deliveryModeStr.equals("PERSISTENT")
>             ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
>
>     // Set the reply destination, first looking it up using JNDI
>     Destination replyDestination = ctx.lookup(replyToName);
>     jmsMessage.setJMSReplyTo(replyDestination);
>
>     // and finally, send the message.
>     producer.send(jmsMessage, deliveryMode, priority, timeToLive);
> }
>
> Note the API for the Message class where these methods are documented 
> as being solely for JMS providers:
>
>     
> http://download.oracle.com/javaee/1.3/api/javax/jms/Message.html#setJMSPriority(int)
>
> Cheers,
> Andrew.
Received on Tuesday, 23 November 2010 22:08:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 18:16:25 GMT