Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Building Flow Services | The EXIT Step
 
The EXIT Step
 
Exiting on Success or Failure
Exiting from Iterations, Steps, or Services
Building an EXIT Step
The EXIT flow step exits the entire flow service, a specific parent flow step, or an iteration within a LOOP or REPEAT step and signals success or failure as part of the exit. When exiting the entire flow service, the EXIT step transfers execution control to an ancestor service which could be a flow service or a Java service. If exit causes the top-level of the flow service to exit, then the flow service execution ends either successfully or with an exception. When exiting a step within the flow service, the EXIT step transfers execution control to another flow step.
Whether or not execution of the service continues and to where control is transferred depends on whether the EXIT step signals success or failure and from what the EXIT step is exiting.
Examples of when to use the EXIT step include:
*Exiting an entire flow service from within a series of deeply nested steps.
*Throwing an exception when you exit a flow or a flow step without having to write a Java service that throws a ServiceException.
*Completing a flow step abruptly.
*Exiting a LOOP or REPEAT flow step without throwing an exception.
*Exiting an iteration of a LOOP or REPEAT flow step without exiting the entire LOOP or REPEAT step.
The following flow service contains two EXIT steps that, if executed, will exit the nearest ancestor LOOP step. If the value of CreditCardType is null or an empty string, the matching EXIT step executes and exits the LOOP over the '/POs/PurchaseOrdersList' step.
Use the EXIT step to exit the nearest ancestor LOOP step