We have a poison message scenario in our Java EE application. What we want to do is when the transaction is being rolled back by the Java EE container, JMS redelivers the message, however when it does we want the JMS to tell if a re-delivery attempt is being made. Once we know that a re-delivery is made we want to commit the transaction without rolling back so that the message is removed from the Topic.
From the documentation it looks like JMSXDeliveryCount property will be set by AQ. However during my investigation I found that this property is being set to 1 always when the message is being re-delivered multiple times by AQ. I was wondering anyone has encountered a similar scenario and looking for solutions that you might have attempted to solve this issue.