A succeed step terminates a serial flow early, similar to a return statement in programming languages.
Introduction
Steps defined in a Flow Definition Language (FDL) steps block execute serially. A succeed step interrupts this sequence and terminates the flow early, similar to a return statement in programming languages. Succeed steps are often combined with choice steps to stop further execution when a specific condition is met.
A succeed step has the following properties:
- (Required) type: The value succeed indicates that the step is a succeed step.
- (Required) name: The name of the step.
- (Optional) inputMappings: The input mapping.
- (Optional) outputMappings: The output mapping.
Example
The following flow definition uses a succeed step to end execution early based on input conditions.
- If the value of
statusin the input isready, thepass1step in the first choice is executed, followed by thefinalstep. Becausefinalis a succeed step, thehandle_failurestep is not executed afterward. - If the value of
statusin the input isfailed, the second choice is executed. This ends the choice step and executeshandle_failure. - If the input does not contain
statusor thestatusvalue is notreadyorfailed, the default logic is executed:pass2andhandle_failure.
version: v1
type: flow
steps:
- type: choice
name: mychoice
choices:
- condition: $.status == "ready"
# choice with steps
steps:
- type: pass
name: pass1
- condition: $.status == "failed"
# choice with goto
goto: handle_failure
default:
# choice with both steps and goto
steps:
- type: pass
name: pass2
goto: handle_failure
- type: succeed
name: final
- type: pass
name: handle_failure