This topic describes succeed steps and related examples.
Overview
A succeed step ends a series of serial steps in advance, similar to return
in programming languages. Flow Definition Language (FDL) steps
are serial steps. In general, a next step is executed after a previous step is completed. However, after a succeed step is executed, subsequent steps are not executed. Succeed steps are usually used together with choice steps. When the conditions of a choice step are met, the flow goes to a succeed step, and no other steps are executed.
A succeed step contains the following attributes:
- type: Required. The step type. The value succeed indicates that the step is a succeed step.
- name: Required. The step name.
- inputMappings: Optional. The input mappings.
- outputMappings: Optional. The output mappings.
Examples
The following sample flow ends in advance by using a succeed step.
- If the value of
status
in the input isready
, thepass1
andfinal
steps of the first choice are executed in sequence. Thefinal
step is a succeed step. Therefore, after it is executed, thehandle_failure
step will not be executed. - If the value of
status
in the input isfailed
, the goto instructions of the second choice are executed, the choice step ends, and thehandle_failure
step is executed. - If the input does not contain
status
or the value ofstatus
is neitherready
norfailed
, the default choice is executed, that is, thepass2
andhandle_failure
steps are executed.
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