I have an EJB that is message driven which receives messages from a HornetQ (2.1.13) JMS queue. The application in question runs on JBoss 7.1. I know I can configure this on the server, using xml, like this:
<max-delivery-attempts>3</max-delivery-attempts>
The reason why I'm considering not using this way is because we perform some logic if it is the last try (i.e. try number 3), so I would prefer not to put this configuration in several places.
The code in question is upgraded from JBoss 4, where the maximum number of delivery attempts could be configured like below. However, this is very specific configuration for the JMS implementation used in JBoss 4 (which is not HornetQ).
@MessageDriven(name = "SomeMessageBean", activationConfig = {
@ActivationConfigProperty(propertyName = "dLQMaxResent", propertyValue = "3")
})
Is there any way in HornetQ to set the attribute <max-delivery-attempts>
directly in the Java code (preferably with annotations) of the Message Driven Bean? Or is there even a JMS way to find out if it is the last re-send (meaning I don't have to care about the number at all)?