6 Replies Latest reply on May 3, 2013 3:32 AM by Gary Brown

    Transaction behavior with faults/errors

    Keith Babo Master

      Tomo and I have been discussing SWITCHYARD-1431 and I wanted to open the discussion up to a wider audience based on the scope of changes.  Here is a summary of the proposed changes:


      • TransactionHandler will set active transactions to rollbackOnly when an unexpected fault/error occurs.
      • Expected exceptions are documented in the service contract.
      • Unexpected exceptions include:
        • RuntimeException
        • SwitchYardException
        • HandlerException wrapping an exception not documented in the service contract.
      • Since components are in the best position to determine whether the exception is expected or not, each component is expected to do the following:
        • Unexpected exceptions are thrown as HandlerException
        • Expected exceptions are communicated via sendFault().
      • A component involved in a message exchange can "opt out" of this automatic rollback behavior via a context property at Scope.EXCHANGE.


      The following changes will be required at a minimum:

      • Define a constant for the "opt out" rollback property.  A place in core/api is preferable and Exchange seems like a good spot.
      • TransactionHandler needs to be updated to check fault status and the message content to determine if it's RuntimeException, SwitchYardException, or HandlerException.  If it's one of these cases and a transaction is in progress, set it to rollback.
      • Components need to be updated to *not* report expected faults using HandlerException.  The bean component is doing the wrong thing for sure.  I think SOAP gateway is doing the right thing based on a cursory review.


      Feedback and corrections are welcome.