Redelivered messages to consumer skiped due to false duplicate detection on 
message rollback with Spring and cacheLevel=CACHE_NONE
----------------------------------------------------------------------------------------------------------------------------------

                 Key: AMQ-2032
                 URL: https://issues.apache.org/activemq/browse/AMQ-2032
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.2.0
         Environment: Spring DMLC, cacheLevel=CACHE_NONE
            Reporter: Gary Tully
            Assignee: Gary Tully
             Fix For: 5.3.0


The failover default brokerUrl in 5.2 activates the message audit facility to 
catch possible duplicate message delivery in the event of failover. This 
mechanism can get in the way of message redelivery, particularly when sessions 
are closed and an automatic rollback kicks in.

Original user comment:
----
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.

Sequence: ( See: 
http://fisheye1.atlassian.com/browse/springframework/spring/src/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java?r=1.14
 )

    * 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


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. Sequence: ( See: 
http://fisheye1.atlassian.com/browse/springframework/spring/src/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java?r=1.14
 )

    * 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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to