JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-4376

Unexpected redelivery behaviour in ActiveMQ JMS Connector

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.2.1
  • Fix Version/s: Bug Backlog
  • Component/s: Transport: JMS
  • Labels:
    None
  • Environment:

    Mule 2.1.1, JDK 1.5.0_16; WinXP

  • User impact:
    Medium
  • Configuration:
    Hide

    <service name="TransactionOnInboundOnly">
    <inbound>
    <jms:inbound-endpoint queue="FromTest02" transformer-refs="JMSToObject" synchronous="false">
    <jms:transaction action="ALWAYS_BEGIN" timeout="15000"/>
    </jms:inbound-endpoint>
    </inbound>
    <outbound>
    <pass-through-router>
    <file:outbound-endpoint path="./FromJMS" outputPattern="${OUTPUTPATTERN}" synchronous="false"/>
    </pass-through-router>
    </outbound>
    </service>

    Show
    <service name="TransactionOnInboundOnly"> <inbound> <jms:inbound-endpoint queue="FromTest02" transformer-refs="JMSToObject" synchronous="false"> <jms:transaction action="ALWAYS_BEGIN" timeout="15000"/> </jms:inbound-endpoint> </inbound> <outbound> <pass-through-router> <file:outbound-endpoint path="./FromJMS" outputPattern="${OUTPUTPATTERN}" synchronous="false"/> </pass-through-router> </outbound> </service>
  • Log Output:
    Attached as log file
  • Similar Issues:
    None

Description

See config for this.

I send a message on the inbound JMS queue which starts a transaction; once the message hits the outbound endpoint (which cannot participate in the transaction) the transaction is rolled back. This is the expected behaviour and with Mule 2.1, those were the results I used to get.

With Mule 2.2.1 I get different results. Tracing the transaction and endpoint-message notifications, I notice the following:

1) With both versions, the first notification is transaction_BEGAN
2) With both versions, the 2nd notification is MESSAGE_DISPATCHED
3) With both versions, the 3rd notification is MESSAGE_RECEIVED
4) With both versions, the 4th notification is TRANSACTION_ROLLEDBACK
With Mule 2.2.2, there are some more notifications:
5) TRANSACTION_BEGAN
6) MESSAGE_RECEIVED
7) TRANSACTION_ROLLEDBACK

I dug deeper and noticed that the message used in (6) above is identical to the first one except that the JMSRedelivery property is set to true. I set maxRedelivery="0" in my config thinking that the default had changed but this was not it.

Digging into the source, I found this in ActiveMqJmsConnector (line 73):

// redelivery = deliveryCount - 1, but AMQ is considering the first delivery attempt as a redelivery (wrong!). adjust for it
setMaximumRedeliveriesMethod.invoke(redeliveryPolicy, getMaxRedelivery() + 1);

Thinking that perhaps Mule is over-compensating, I set maxRedelivery="-1" and got the results I expected.

Note: Apart from the over-compensation, I don't think I should be allowed to set this attribute to a value less than zero ...

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    mule.log
    28/May/09 11:21 AM
    464 kB
    Antoine Borg
  2. XML File
    mule-config.xml
    11/Jun/09 03:45 AM
    2 kB
    Antoine Borg
  3. Java Source File
    TransactionsTestSuite.java
    29/Jun/09 04:45 AM
    8 kB
    Antoine Borg

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Andrew Perepelytsya added a comment - 28/May/09 11:24 AM

And which AMQ version is that? I know that this setting has been messed with a lot since 4.x. The compensation is required for 4.x (as explained in the source comment)

Show
Andrew Perepelytsya added a comment - 28/May/09 11:24 AM And which AMQ version is that? I know that this setting has been messed with a lot since 4.x. The compensation is required for 4.x (as explained in the source comment)
Hide
Permalink
Antoine Borg added a comment - 29/May/09 01:25 AM

Ouch - the one detail I forgot to include ... sorry about that.

ActiveMQ 4.1.1

Show
Antoine Borg added a comment - 29/May/09 01:25 AM Ouch - the one detail I forgot to include ... sorry about that. ActiveMQ 4.1.1
Hide
Permalink
Daniel Feist added a comment - 29/May/09 11:44 AM

Andrew, Please raise this to critical if it is a regression and has no work around.

Show
Daniel Feist added a comment - 29/May/09 11:44 AM Andrew, Please raise this to critical if it is a regression and has no work around.
Hide
Permalink
Ken Yagen added a comment - 29/May/09 12:34 PM - edited

An issue was fixed with redelivery in 2.2 that does change the behavior of redelivery (correcting a problem that existed previously). Please see MULE-4162. Is it possible that the fix for this issue uncovered a subtle change in AMQ behavior between versions? The Mule test suite runs against AMQ 4.1.2. Can you try your test with that version to see if it's any different?

Show
Ken Yagen added a comment - 29/May/09 12:34 PM - edited An issue was fixed with redelivery in 2.2 that does change the behavior of redelivery (correcting a problem that existed previously). Please see MULE-4162. Is it possible that the fix for this issue uncovered a subtle change in AMQ behavior between versions? The Mule test suite runs against AMQ 4.1.2. Can you try your test with that version to see if it's any different?
Hide
Permalink
Antoine Borg added a comment - 03/Jun/09 10:57 AM

I have just retested with AMQ 4.1.2 and have the same result - I need to set maxRedelivery to -1 before it will work

Show
Antoine Borg added a comment - 03/Jun/09 10:57 AM I have just retested with AMQ 4.1.2 and have the same result - I need to set maxRedelivery to -1 before it will work
Hide
Permalink
Andrew Perepelytsya added a comment - 03/Jun/09 11:09 AM

Also note that the number of consumers will affect the count, it's not absolutely reliable (depends on vendor implementation). What it really takes care of is 'once it's over the threshold, do something'. Have you tried with consumers count set to 1?

Show
Andrew Perepelytsya added a comment - 03/Jun/09 11:09 AM Also note that the number of consumers will affect the count, it's not absolutely reliable (depends on vendor implementation). What it really takes care of is 'once it's over the threshold, do something'. Have you tried with consumers count set to 1?
Hide
Permalink
Antoine Borg added a comment - 05/Jun/09 04:01 AM

Thanks for the tip Andrew.

With ActiveMQ 4.1.2 and numberOfConsumers="1", I still get the problem and need to leave maxRedelivery="-1"

I tried with ActiveMQ 4.1.1 and numberOfConsumers="1" but still need to set maxRedelivery="-1"

Show
Antoine Borg added a comment - 05/Jun/09 04:01 AM Thanks for the tip Andrew. With ActiveMQ 4.1.2 and numberOfConsumers="1", I still get the problem and need to leave maxRedelivery="-1" I tried with ActiveMQ 4.1.1 and numberOfConsumers="1" but still need to set maxRedelivery="-1"
Hide
Permalink
Antoine Borg added a comment - 11/Jun/09 03:45 AM

I've added the complete mule-config.xml if it's of any help. The relevant part is the service I've already added, but you never know what may be affecting things

Show
Antoine Borg added a comment - 11/Jun/09 03:45 AM I've added the complete mule-config.xml if it's of any help. The relevant part is the service I've already added, but you never know what may be affecting things
Hide
Permalink
Antoine Borg added a comment - 29/Jun/09 04:45 AM

Attached test case too to show how I'm testing this configuration

Show
Antoine Borg added a comment - 29/Jun/09 04:45 AM Attached test case too to show how I'm testing this configuration
Hide
Permalink
Fabien Arrault added a comment - 18/Mar/11 11:37 AM

This issue is reproductible with Mule 3.1.0 and ActiveMQ 5.2.0

Don't know if it's new with Mule 3, but this error log is quite clear :

ERROR 2011-03-18 17:22:28,379 [ActiveMQ Session Task] org.mule.exception.DefaultServiceExceptionStrategy:
********************************************************************************
Message : "Message with id "ID:inge30-THINK-50205-1300465348000-0:0:4:1:1" has been redelivered 1 times on endpoint "jms://FromTest02", which exceeds the maxRedelivery setting of 0 on the connector "ActiveMQ". Message payload is of type: ActiveMQTextMessage
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. "Message with id "ID:inge30-THINK-50205-1300465348000-0:0:4:1:1" has been redelivered 1 times on endpoint "jms://FromTest02", which exceeds the maxRedelivery setting of 0 on the connector "ActiveMQ". Message payload is of type: ActiveMQTextMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException)
org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:85 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:inge30-THINK-50205-1300465348000-0:0:4:1:1" has been redelivered 1 times on endpoint "jms://FromTest02", which exceeds the maxRedelivery setting of 0 on the connector "ActiveMQ". Message payload is of type: ActiveMQTextMessage
at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:85)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:385)
at org.mule.transport.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:96)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

Show
Fabien Arrault added a comment - 18/Mar/11 11:37 AM This issue is reproductible with Mule 3.1.0 and ActiveMQ 5.2.0 Don't know if it's new with Mule 3, but this error log is quite clear : ERROR 2011-03-18 17:22:28,379 [ActiveMQ Session Task] org.mule.exception.DefaultServiceExceptionStrategy: ******************************************************************************** Message : "Message with id "ID:inge30-THINK-50205-1300465348000-0:0:4:1:1" has been redelivered 1 times on endpoint "jms://FromTest02", which exceeds the maxRedelivery setting of 0 on the connector "ActiveMQ". Message payload is of type: ActiveMQTextMessage Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. "Message with id "ID:inge30-THINK-50205-1300465348000-0:0:4:1:1" has been redelivered 1 times on endpoint "jms://FromTest02", which exceeds the maxRedelivery setting of 0 on the connector "ActiveMQ". Message payload is of type: ActiveMQTextMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException) org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:85 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html) -------------------------------------------------------------------------------- Root Exception stack trace: org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:inge30-THINK-50205-1300465348000-0:0:4:1:1" has been redelivered 1 times on endpoint "jms://FromTest02", which exceeds the maxRedelivery setting of 0 on the connector "ActiveMQ". Message payload is of type: ActiveMQTextMessage at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:85) at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:385) at org.mule.transport.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:96) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************
Hide
Permalink
Arved Sandstrom added a comment - 09/Nov/12 07:10 AM

This issue also reproducible with Mule CE 3.3 and WebSphere MQ. <jms:inbound-endpoint /> goes into the infinite "redelivery" loop described here unless "maxRedelivery" on the connector is set to -1.

Show
Arved Sandstrom added a comment - 09/Nov/12 07:10 AM This issue also reproducible with Mule CE 3.3 and WebSphere MQ. <jms:inbound-endpoint /> goes into the infinite "redelivery" loop described here unless "maxRedelivery" on the connector is set to -1.

People

  • Assignee:
    Unassigned
    Reporter:
    Antoine Borg
Vote (1)
Watch (3)

Dates

  • Created:
    28/May/09 11:20 AM
    Updated:
    09/Nov/12 07:10 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.