Designer 10.7 | webMethods Service Development Help | Building Flow Services | The EXIT Step | Exiting from Iterations, Steps, or Services
 
Exiting from Iterations, Steps, or Services
 
Java Equivalents for EXIT Behavior
When you build an EXIT step, you specify from what you want the EXIT step to exit, such as an iteration of a LOOP or REPEAT step, a parent flow step, a specific flow step, or the entire flow service. When exiting a step within the flow service, execution continues with the step that follows the step that the EXIT step exits from.
If execution of the EXIT step causes Integration Server to reach the end of the flow service (that is, there is no next step in the same flow service), the flow service ends. Whether the EXIT signaled success or failure determines if the flow service completes with success or failure. If the service completes with failure, then Integration Server throws the pending exception. If the EXIT step signaled failure but did not specify a specific exception, then Integration Server throws a FlowException.
The following table indicates how Integration Server responds based on the Exit from property value for an EXIT step.
Exit from value
Description
$parent
Immediately exits from the parent flow step regardless of the flow step type.
$loop
Exits from the nearest ancestor LOOP or REPEAT flow step.
Exiting a $loop with failure from within a TRY, CATCH, or FINALLY step is not permitted if the EXIT step is an immediate child of the TRY, CATCH, or FINALLY step. This is considered to be a Flow definition error. This results in a FlowException and immediate termination of the flow service.
It is possible, however, to exit a $loop with failure from within more deeply nested steps inside of the TRY, CATCH, or FINALLY, as long as the failure is handled (for example by a SEQUENCE step configured to exit on done) before control returns to the TRY, CATCH, or FINALLY step.
When exiting from a LOOP step, Integration Server does not copy the current value of the output variable into the output array. This is true even if the LOOP step contains a MAP step or INVOKE step that maps or sets the value of the output array variable. Exiting from a LOOP prevents normal completion of the body of the LOOP step, which, in turn, prevents the copying of the value of the output array variable to the pipeline.
$flow
Integration Server exits from parent flow steps of the EXIT step until reaching the top of the flow service. An exit from value of $flow indicates that Integration Server exits the entire flow service.
Exit from $flow with failure is immediate and Integration Server does not execute any intervening CATCH or FINALLY steps.
Exit from $flow with success will execute any intervening FINALLY steps between the EXIT and the top of the Flow.
$iteration
Exits from the current iteration of the nearest parent LOOP or REPEAT step. Integration Server terminates the current iteration of the parent LOOP or REPEAT step nearest to the EXIT step. Integration Server then starts execution of the next iteration of the LOOP or REPEAT step.
Note:
When exiting from an iteration, the EXIT must signal success. Exiting from an iteration and signaling failure is not allowed and, when executed, results in a FlowException and immediate termination of the flow service. Note that an EXIT step can signal failure when exiting from a $loop.
Note:
When exiting from an iterationIntegration Server does not roll back any actions that occurred before execution of the EXIT step. For example, if the output of the iteration is set in the output array variable before the EXIT step executes, the iteration output will still appear in the output array variable.
Within a LOOP step, an exit $iteration executed from a containing TRY, CATCH, or FINALLY step causes an abrupt completion of that step and any intervening steps up to the LOOP step. An abrupt completion of a FINALLY step with an uncaught failure results in the failure being discarded.
Within a REPEAT step, an exit $iteration executed from a containing TRY, CATCH, or FINALLY step causes an abrupt completion of that step and any intervening steps up to the REPEAT step. An abrupt completion of a FINALLY with an uncaught failure results in the failure being discarded. This can result in repeat-on failure becoming a success and completing the execution of the REPEAT step.
label
Integration Server exits parent flow steps until reaching the flow step with the specified label. The specified label must be an ancestor flow step to the EXIT step. If it is not, the flow service ends with a FlowException.
Exiting from a label with failure from within a TRY, CATCH, or FINALLY step is not permitted if the EXIT step is an immediate child of the TRY, CATCH, or FINALLY step. This is considered to be a Flow definition error and results in a FlowException and immediate termination of the flow service.
It is possible, however, to exit from a label with failure from within more deeply nested steps inside of the TRY, CATCH, or FINALLY, as long as the failure is handled (for example by a SEQUENCE step configured to exit on done) before control returns to the labeled step.
For more information about the use of the EXIT step within TRY, CATCH, and FINALLY, see Limitations for the TRY, CATCH, and FINALLY Steps.