Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-1278

While using DefaultMessageListenerContainer transactions are not properly rolled back

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2, 3.2.1, 3.3
    • 3.2.2, 3.3
    • None
    • None

    Description

      While using DefaultMessageListenerContainer the JMSConsumer is not properly rolling back transactions.

      In AbstractMessageListenerContainer in doExecuteListener(...). it invokes rollbackIfNecessary(...)

      The condition in rollbackIfNeccessary(): "session.getTransacted() && isSessionLocallyTransacted(session)" is evaluating to false at runtime so the rollback is not executed.

      isSessionsLocallyTransacted(...) was evaluated to false because JmsAccessor.sessionTransacted field is set to false;

      The reason is due to JmsConsumerEndpoint.createDefaultMessageListenerContainer(...) method implementation:

      else if (TRANSACTED_JMS.equals(transacted)) {
                  if (jms102) {
                      cont.setTransactionManager(new JmsTransactionManager102(getConnectionFactory(), isPubSubDomain()));
                  } else {
                      cont.setTransactionManager(new JmsTransactionManager(getConnectionFactory()));
                  }
              }
      

      Needs to be

      } else if (TRANSACTED_JMS.equals(transacted)) {
                  cont.setSessionTransacted(true);
                  if (jms102) {
                      cont.setTransactionManager(new JmsTransactionManager102(getConnectionFactory(), isPubSubDomain()));
                  } else {
                      cont.setTransactionManager(new JmsTransactionManager(getConnectionFactory()));
                  }
              }
      

      Attachments

        1. SM-1278.diff.txt
          0.8 kB
          Bruce Snyder

        Activity

          People

            bsnyder Bruce Snyder
            bsnyder Bruce Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: