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

Messages with AMQ_SCHEDULED_DELAY do not respect transactions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 5.9.0
    • None
    • None

    Description

      Currently delayed messages are delivered even if the session it was sent in is rolled back. According to http://activemq.2283324.n4.nabble.com/AMQ-SCHEDULED-DELAY-and-transactional-boundaries-td4658339.html this is because the message can be delivered far in the future and the transaction would take to long.

      I don't agree with that argument. The transaction can be short living. It is only the enqueuing of the delayed message in the broker that has to be part of the transaction. The delivery to the consumer is not part of the transaction anymore.

      e.g. consider the scenario in the following preudo code:

      while (application_runs)
      try

      { msg = session.Receive(); session.SendDelayed(anotherMessage); if (random(5) != 0) throw exception; session.Commit(); }

      catch

      { session.Rollback; }

      Currently a delayed message is sent for each retry. So we will get a lot more messages in the future as we would expect. When delayed messages would respect transactions just the successful ones would be enqueued. The other ones are rolledback with the transaction.

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            remogloor Remo Gloor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: