0 Replies Latest reply on Jan 14, 2009 2:12 PM by James McPhail

    want transaction commit control inside bean

    James McPhail Newbie

      Currently I am using a MDB which uses container-controlled transactions. The MDB can specify to rollback the transaction, at which point it gets re-tried.

      A new situation has arisen where I don't want certain messages from being placed on the JMS queue while other (possibly conflicting) messages are being run.

      When we have a message ready to place on the JMS queue, the solution proposed involves:

      1) checking whether any conflicting messages are currently queued
      a. if so, block until they have completed
      b. if not, proceed and block subsequent messages from queuing until
      this unit of work is complete
      2) place the message on the JMS queue
      3) when the message/unit of work is complete, signal the waiting messages (from 1.a) that they can proceed


      Can the transaction settings for MDBs be changed such that I can manually commit the transaction within the bean and then perform this signalling step (step 3) from within the bean, while still maintaining the ability to rollback the transaction and have the JMS provider re-invoke the MDB (as you would see using Container managed transactions, where the transaction is not started in the bean itself).

      Alternatively, is there a way of attaching a listener to a particular message/unit of work so that I may know when it has dropped out of the active JMS system (either by being successfully processed or by rolling back the maximum number of times)? I could then do the Step 3 work in this listener.

      Or thirdly is there a superior solution to what I've outlined above?

      Any help is greatly appreciated.

      I use JBoss4.0.3SP1.