Skip to main content

JMS message queue - mesages timeout and delivery mode managemet

2 replies [Last post]
lzwierko
Offline
Joined: 2009-09-24

Hi,

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?

thanks for help
Lukasz

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nigeldeakin
Offline
Joined: 2007-10-12

> 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

lzwierko
Offline
Joined: 2009-09-24

Nigel,
thanks for the info!