Affects Version/s: 18.104.22.168-fuse
Fix Version/s: 22.214.171.124-fuse
Environment:Fuse MB 126.96.36.199, activemq-core, ActiveMQMessageConsumer.java
Spring 2.5.5 DMLC with cacheLevel=CACHE_NONE with JBoss 4.2.2 + XA transactions
Redelivery of message fails after a rollback with Spring DMLC with cacheLevel=CACHE_NONE due to a bug in class : 'org.apache.activemq.ActiveMQMessageConsumer'. Redelivered messages are wrongly detected as duplicates. It fails to call 'rollbackDuplicates' on messages processed by consumer on rollback call on the consumer.
- Spring creates a transaction
- Spring creates a JMS consumer
- Spring give message to Application MessageListener class
- Spring closes the consumer
- Spring try to commit
- Commit fails due to a RuntimeException thrown in Application MessageListener class
- Spring marks the message as RollbackOnly
- Spring rollbacks message
When ActiveMQ closes the consumer ( org.apache.activemq.ActiveMQMessageConsumer ), it clears 'deliveredMessages' list. But this list is needed in rollback method of ActiveMQMessageConsumer to rollback duplicates ! Then consumer cannot rollback duplicates on rollback if consumer is closed before rollback action.
The only way I found, is to not clear 'deliveredMessages' list on close. It seems, there is no side effect, since after a call to 'close' method, the consumer is not used anymore.