Skip to main content

Terminate Task

"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 Cases

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 TERMINATE.

"name": "terminate",
"taskReferenceName": "terminate0",
"inputParameters": {
"terminationStatus": "COMPLETED",
"workflowOutput": { "result": "${task0.output}"}
"type": "TERMINATE",
"startDelay": 0,
"optional": false



terminationStatusStringcan only accept "COMPLETED" or "FAILED"task cannot be optional
workflowOutputAnyExpected workflow output
terminationReasonStringFor failed tasks, this reason is passed to a failureWorkflow



outputMapThe content of workflowOutput from the inputParameters. An empty object if workflowOutput is not set.


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 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.

Conductor UI - Workflow Diagram

Codelab examples

Best Practices

  1. Include termination reason when terminating the workflow with failure status to make it easy to understand the cause.
  2. Include any additional details (e.g. output of the tasks, switch case etc) that helps understand the path taken to termination.