368 Patterns: Implementing Self-Service in an SOA Environment
Figure 11-4 Specifing a message selector for a message-driven dean
The selector string can refer to fields in the JMS message header and fields in
the message properties. Message selectors cannot reference message body
values.
11.3.4 Message time-to-live
The default messaging provider provides a mechanism through JMS to set the
time-to-live of a message. The code in Example 11-2 shows how we can set
time-to-live within this scenario to 20 seconds.
Example 11-2 Setting the JMS message time-to-live
producer.send(reqMsg,DeliveryMode.NON_PERSISTENT,0,20000);
Setting the message time-to-live is an important best practice to avoid large
numbers of unconsumed messages on queues.

Get Patterns: Implementing Self-Service in an SOA Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.