Java CAPS JMS Reference

Delay and Redirect

After a certain number of failed redelivery attempts, you may want to redirect the message to a different target destination, such as a dead-letter queue. The format for redirecting is retries:move(args), where the arguments can be queue:target, topic:target, or same:target.

The argument component same specifies the same kind of message destination as the message source. That is, if the message was received from a queue, it will be sent to a queue; if the message was received from a topic, it will be sent to a topic.

The argument component target can be any string and can include the character $, which is automatically replaced with the original destination name.

The following example shows a string that specifies a one-second delay following five failed attempts at redelivery, a 5–second delay following a total of ten failed attempts, then redirects the message to a dead-letter queue named mydlq after a total of 50 failed attempts.

Example 3


5:1000; 10:5000; 50:move(queue:mydlq)

The following example shows a string that specifies a one-second delay following five failed attempts at redelivery, a five second delay following a total of ten failed attempts, then redirects the message to a dead-letter queue after a total of 50 failed attempts. If the message was received from a source destination named Queue1, the message will be redirected to a target destination named dlqQueue1error.

Example 4


5:1000; 10:5000; 50:move(queue:dlq$error)