users@glassfish.java.net

Re: JMS message queue - mesages timeout and delivery mode managemet

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 Sep 2009 07:46:51 PDT

> how does one configure messages expiry timeout and
> delivery mode in JMS queues in glassfish application
> server (2.1) ? In the admin web interface, there are
> session parameters only. I suppose this should be
> configured per queue not per message?

You need to set deliveryMode and timeToLive programmatically on the MessageProducer (or its subclasses QueueSender and TopicPublisher).

MessageProducer.setTimeToLive(long timeToLive)
MessageProducer.setDeliveryMode(int deliveryMode)

...or you can override these values on a per-message basis by sending the message using

MessageProducer.send(Message message, int deliveryMode, int priority, long timeToLive)

See the API specification at
http://java.sun.com/javaee/5/docs/api/javax/jms/MessageProducer.html

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

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