maximumRedeliveries not honoured when transacted session is closed without 
explicit rollback
--------------------------------------------------------------------------------------------

                 Key: AMQ-1601
                 URL: https://issues.apache.org/activemq/browse/AMQ-1601
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker, JMS client
    Affects Versions: 5.1.0
         Environment: Windows XP SP2, Sun JDK 1.5.0_8
            Reporter: Stirling Chow
         Attachments: ActiveMQTest.zip

1) Unzip attachment into a directory
2) Edit build.xml and change activemq.home to point to your ActiveMQ 
distribution
3) Run "ant" and observe that one of the 2 JUnit tests fail
4) Refer to test-report for information about the failure

The first JUnit test creates a temporary broker and submits a single message to 
the queue "test.queue".  It then creates a transacted message consumer that 
retrieves the message, prints out details about it, and then rollsback and 
closes the session.  Subsequent retries by the consumer verify that the message 
is redelivered up to the MAX_REDELIVERIES constant in 
RedeliveryRollbackTest.java.  Finally, the test verifies that after 
MAX_REDELIVERIES, test.queue is empy (i.e., the message has been recognized as 
a poison pill).

The second JUnit test performs the same sequence of operations, but instead of 
explicitly rolling back the session, it just closes the session.  According to 
the JavaDoc for javax.jms.session#close():

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/index.html

"Closing a transacted session must roll back the transaction in progress. "

In other words, I was expecting the behaviour to be the same for both test 
cases.  However, although the delivery count is updated on the message, it 
continues to get delivered regardless of the MAX_REDELIVERIES setting.

ADDITIONAL CONCERN
---------------------------------
Observe the console output of the tests and note how the delivery count 
increments by two for the test that works, but only by one for the test that 
doesn't:

Attempt 1
Received message id=ID:schow-desktop-4347-1203977945999-2:0:1:1:1, 
redelivered=false, delivery count=1
Attempt 2
Received message id=ID:schow-desktop-4347-1203977945999-2:0:1:1:1, 
redelivered=true, delivery count=3
Attempt 3
Received message id=ID:schow-desktop-4347-1203977945999-2:0:1:1:1, 
redelivered=true, delivery count=5
Attempt 4
Received message id=ID:schow-desktop-4347-1203977945999-2:0:1:1:1, 
redelivered=true, delivery count=7
Attempt 5
No message available.
Attempt 1
Received message id=ID:schow-desktop-4347-1203977945999-2:1:1:1:1, 
redelivered=false, delivery count=1
Attempt 2
Received message id=ID:schow-desktop-4347-1203977945999-2:1:1:1:1, 
redelivered=true, delivery count=2
Attempt 3
Received message id=ID:schow-desktop-4347-1203977945999-2:1:1:1:1, 
redelivered=true, delivery count=3
Attempt 4
Received message id=ID:schow-desktop-4347-1203977945999-2:1:1:1:1, 
redelivered=true, delivery count=4
Attempt 5
Received message id=ID:schow-desktop-4347-1203977945999-2:1:1:1:1, 
redelivered=true, delivery count=5

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