7 Replies Latest reply on Feb 29, 2008 9:57 AM by Daniel Bevenius

    Transaction rollback in action pipeline

    Daniel Bevenius Master

      When using a global transaction with an action pipeline it is possible for a participant in the transaction to rollback the transaction. For example, an action invoking a database, could call rollback on the connection and have the global transaction rolled back.

      But we are also seeing the need to be able to trigger a rollback from other actions in the pipeline.

      One use case we have is where we are calling external webservices.
      These webservices sometimes respond with faults, like the service is temporarliy unvailable or something like that.
      We need to be able to resend these request to the webservices and thought we would use transactions for this.
      When we receive a fault we would like to rollback the transaction, which will put the JMS message back on the queue for pickup. (assuming JMS transport here)

      This in combination with specifying JCA/JMS redelivery properties like MaxDeliveryAttempts and RedeliveryDelay we can achive what we want.
      For more information about how this redelivery could work see this jira : http://jira.jboss.com/jira/browse/JBESB-1563.

      The problem is that to rollback the transaction we must throw a RuntimeException.

      Is there a way to rollback the transaction in an action pipeline without throwing a RuntimeException?

      Should we create an execption specifically for this need that can be used by actions, like a RollbackException?

      Any thoughs on this?

      Thanks,

      Daniel