"type" : "TERMINATE"
Task that can terminate a workflow with a given status and modify the workflow's output with a given parameter,
it can act as a
return statement for conditions where you simply want to terminate your workflow.
Use it when you want to terminate the workflow without continuing the execution.
For example, if you have a decision where the first condition is met, you want to execute some tasks, otherwise you want to finish your workflow.
Terminate task is defined directly inside the workflow with type
|terminationStatus||String||can only accept "COMPLETED" or "FAILED"||task cannot be optional|
|workflowOutput||Any||Expected workflow output|
|output||Map||The content of |
Let's consider the same example we had in Switch Task.
Suppose in a workflow, we have to take decision to ship the courier with the shipping service providers on the basis of input provided while running the workflow. If the input provided while running workflow does not match with the available shipping providers then the workflow will fail and return. If input provided matches then it goes ahead.
Here is a snippet that shows the defalt switch case terminating the workflow:
Workflow gets created as shown in the diagram.
- Include termination reason when terminating the workflow with failure status to make it easy to understand the cause.
- Include any additional details (e.g. output of the tasks, switch case etc) that helps understand the path taken to termination.