Skip to main content

Terminate

A task that can terminate the current workflow with a termination status and reason.

Definitions

{
"name": "terminate",
"taskReferenceName": "terminate_ref",
"inputParameters": {
"terminationStatus": "TERMINATED",
"workflowOutput": {
"key": "value"
},
"terminationReason": "${workflow.input.termination-reason}"
},
"type": "TERMINATE"
}

Input Parameters

AttributeDescription
terminationStatusChoose the termination status while terminating the workflow. It can take values COMPLETED, FAILED, or TERMINATED.
terminationReasonProvide a reason to give a clear understanding of the termination status. The termination reason can also be passed as a variable.
workflowOutputProvide the expected workflow output on termination. It can be a string, number, boolean, null or object/array.
tip

The Terminate task can modify the workflow's output with a given parameter and act as a return statement for conditions where you want to terminate your workflow.

Output Parameters

AttributeDescription
outputReturns the workflow output from the defined input parameter. If workflowOutput is not set, it returns an empty object.

Examples



  1. Add task type Terminate.
  2. Choose the termination status and provide a termination reason.
  3. Optionally set the workflow output.

Adding wait task

Complete Example

Suppose in a workflow; we have to make a decision to ship the courier with the shipping service providers based on input provided while running the workflow. If the input provided while running the workflow does not match with the available shipping providers, then the workflow will fail and return. If the input provided matches, then it goes ahead.
Here is a snippet that shows the default switch case terminating the workflow:

    {
"name": "switch_task",
"taskReferenceName": "switch_task",
"type": "SWITCH",
"defaultCase": [
{
"name": "terminate",
"taskReferenceName": "terminate",
"type": "TERMINATE",
"inputParameters": {
"terminationStatus": "FAILED",
"terminationReason": "Shipping provider not found."
}
}
]
}

Workflow gets created as shown in the diagram.

Terminate Example