users@glassfish.java.net

Re: Post to JMS without transactions?

From: <glassfish_at_javadesktop.org>
Date: Mon, 01 Mar 2010 02:10:30 PST

When sending a message to a queue, it's up to the sender to specify whether they want to send it in a transaction or not, and whether the message should be persisted in the server. Neither is a property of the queue itself.

To send a non-persistent message, use QueueSender.send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive)
and set the deliveryMode argument to DeliveryMode.NON_PERSISTENT
http://java.sun.com/javaee/6/docs/api/javax/jms/QueueSender.html#send%28javax.jms.Message,%20int,%20int,%20long%29

As for how to configure the sender not to use a transaction: this depends on whether you are using a simple JMS client or running in Glassfish; in a simple JMS client simply create a non-transacted session. In Glassfish the use of transaction is configured by the usual CMT or BMT settings. If you need more info just ask.

Nigel
[Message sent by forum member 'nigeldeakin' (nigel.deakin_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=389328