Is there a way of accessing maximum redelivery count from a JMS Message?

3.2k views Asked by At

A simple one.

JMS has a concept of redelivering messages. A JMS queue can be configured with a maximum redelivery count after which the message will not be redelivered.

The javax.jms.Message interface provides methods to check whether a message is redelivered, and get a current redelivery count.

Is there any way of finding out the maximum redelivery count during runtime in a JMS client?

What I am trying to do is to have a method call trigerred on last redelivery of a message. I could just have that number configured, but I was wondering if the JMS exposes somewhere this value so that I can lean on it.

1

There are 1 answers

0
Parag Kutarekar On

There is no way to get the server side max delivery count configuration from the message (javax.jms.Message) object.

However, it is possible to get number of times the current message was redelivered:

long deliveryCount = message.getLongProperty("JMSXDeliveryCount");