Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-1593

redeliveryCounter not updated correctly when using XA transactions and Spring

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0.0
    • 5.3.0
    • None
    • None
    • Mac OS X 10.4, Java 1.6 DP1

    Description

      When using ActiveMQ 5 in combination with XA, I noticed that redelivery of messages is not correctly performed. I am using XA in combination with Spring's DefaultMessageListenerContainer (DMLC) and have a simple test case in which the MessageListener throws an IllegalStateException which triggers a transaction rollback. After that, the message is redelivered, but unfortunately not as many times as my redelivery policy specifies. I am using the following settings:

      • maximumRedeliveries=3
      • initialRedeliveryDelay=10

      If I am not mistaken this means I should receive the message 4 times (once initially and then three times redelivered), but I only get it three times. When I log the messages I receive prior to throwing an ISE, I see the following "inconsistency" with the redeliveryCounter: the initial message has a counter value of 0, the first redelivery message has a counter value of 2 and the second redelivery message has a counter value of 4. After that, I do not receive an additional message.

      I created a simple test case attached to this issue (a Maven 2 project) which is configured with the above settings and shows the described behavior. In order to run the test case, however, you need the Bitronix Transaction Manager (v 1.2) in your local repository (since it is currently not listed in one of the public repositories, you have to download it and put it manually into the local repo). The download url is http://dist.codehaus.org/btm/1.2/btm-dist-1.2.zip and installation is done by unzipping the archive and using

      mvn -Dfile=btm-1.2.jar -DgroupId=btm -DartifactId=btm -Dversion=1.2 -DgeneratePom=true -Dpackaging=jar install:install-file

      to copy it to the repo.

      Spring's DMLC is set to a cacheLevel of 0 (CACHE_NONE) if an external transaction manager is used. If I change the cacheLevel to 2 (CACHE_SESSION) then the correct number of messages is delivered and the counter is correctly updated, so I am not sure whether this is an issue with ActiveMQ or Spring. Anyways, I think I should not loose any messages if I use XA, regardless of the cacheLevel setting...

      Attachments

        Issue Links

          Activity

            People

              gtully Gary Tully
              svenpanko Sven Panko
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: