B2B Integration 10.4 | Administering and Monitoring B2B Transactions | Service Development Help | Failure Handling in Flow Services Using the TRY, CATCH, and FINALLY Steps | About Failure Handling in Flow Services | What Happens When a Failure Occurs?
 
What Happens When a Failure Occurs?
 
com.wm.lang.flow.FlowException versus com.wm.lang.flow.Failure
Failures occur during flow service execution when one of the following occurs:
*An invoked service throws an exception.
*An EXIT step executes and signals failure which causes the step from which it is exiting to end with failure.
*A flow definition error occurs and flow service execution cannot continue. This results in a FlowException and immediate termination of the flow service.
In the first two situations, Integration Server does not immediately throw an exception. Instead, because the flow service might include logic to catch and handle the failure, Integration Server proceeds with flow service execution. However, Integration Server remembers that an exception is pending while flow execution continues. If a flow service completes and an exception is still pending, Integration Server throws the pending exception. If a flow service completes and an EXIT step signaled failure but did not identify a specific exception, Integration Server throws a com.wm.lang.FlowException. This maintains compatibility with previous versions of the flow language.
For example, when a flow service invokes another service and the invoked service throws an exception, Integration Server does not immediately rethrow the exception. Instead Integration Server remembers that there is a pending exception and proceeds with service execution. This allows the service that invoked the failing service an opportunity to handle the exception in some way. If the top-level flow service completes and the failure is still pending, Integration Server throws the exception originally thrown by the service.
Similarly, when Integration Server executes an EXIT step configured to exit and signal failure, Integration Server instantiates a pending exception but does not throw it. Integration Server remembers that there is a pending failure as it unwinds through the various flow steps in the flow service until it reaches the point of exit as determined by the EXIT step. Integration Server then continues with service execution by executing the next flow step. If Integration Server completes execution of the flow service and an uncaught failure remains, Integration Server throws the pending exception. The service that invoked the failing flow service may be built to handle the exception.
If the uncaught failure of type com.wm.lang.flow.Failure is still pending, Integration Server converts the Failure exception to a FlowException. Converting the pending com.wm.lang.flow.Failure to a FlowException preserves compatibility with flow service behavior that existed before changes introduced for the try-catch-finally feature introduced in Integration Server 10.3.
Note: The com.wm.lang.flow.Failure exception is the default type of failure thrown by an EXIT step configured to exit on failure. However, you can use the Failure name or Failure instance properties of an EXIT step to specify the Exception to be raised. If the EXIT step identifies a specific exception to be raised, when the top-level flow service completes and there is still a pending failure thrown by the EXIT step, Integration Server does not convert it to a FlowException.

Copyright © 2016- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release