Skip to main content

Sending Signals to Workflows

In certain scenarios, there might arise a need to transmit signals to workflows for purposes such as pausing, terminating, or restarting them. There are different ways through which you can achieve this.

In this document, let’s look at the different ways to send signals to your workflows in a production environment.

Pause Workflow

You can pause the workflows to wait for external signals. There are different methods to pause your workflow.

Using API

Once the workflow is run, the workflowId will be generated. Use the following API with the workflowId as the input payload to pause your workflow:

PUT /workflow/{workflowId}/pause

SDKs

BulkResponse pauseWorkflow(List<String> workflowIds) throws ApiException

From Conductor UI

From the workflow executions page, click Actions, and choose Pause.

Pausing workflows from UI

Resume Workflow

You can resume the paused workflows once the purpose is served.

Using API

Use the following API with the workflowId as the input parameter to resume your paused workflow:

PUT /workflow/{workflowId}/resume  

SDKs

BulkResponse resumeWorkflow(List<String> workflowIds) throws ApiException

From Conductor UI

From the workflow executions page, click Actions, and choose Resume.

Resuming workflows from UI

Restart Workflow

In certain situations, your workflow may fail due to any reason, and it will reach the terminated state. In such cases, you can quickly restart the workflow execution from the beginning.

Using API

With the workflowId as the input parameter, use the following API to restart the workflow from the beginning with the same input. This operation has no effect when called on a workflow that is not in a terminal status.

POST /workflow/{workflowId}/restart 

SDKs

BulkResponse restartWorkflow(List<String> workflowIds, Boolean useLatestDefinitions) throws ApiException

From Conductor UI

From the workflow executions page, click Actions, and you can choose to restart workflows either using the same definition or with the latest definitions.

Restarting workflows from UI

  • Restart with Current Definitions - Restart the workflow from the beginning using the same version of the workflow definition that originally ran this execution. This is useful if the workflow definition has changed and we want to retain this instance in the original version.
  • Restart with Latest Definitions - Restart this workflow from the beginning using the latest definition of the workflow. If you’ve made changes to the definition, you could use this option to rerun the flow with the latest version.

Rerun Workflow

The restart option restarts the workflow with either the current or latest definitions. However, if you want to run a new instance of the workflow by making changes to the workflow inputs, correlation ID, or task to domain mapping, you can utilize the rerun option.

Using API for rerunning a workflow from a specific task

Once you have the workflowId, you can rerun the workflow from a specific task using the following API. Get the task execution ID from the UI and include it in the API.

Task Execution ID from Conductor UI

POST /workflow/{workflowId}/rerun
{
"reRunFromTaskId": "TASK_ID_TO_REREUN_FROM",
"taskInput": {
//Extra inputs to the task
},
"workflowInput": {
//Changes to workflow inputs as part of re-run
}
}

SDKs

String rerunWorkflow(String workflowId, RerunWorkflowRequest rerunWorkflowRequest)

From Conductor UI

From the workflow executions page, click Actions and choose Re-run Workflow. Clicking on this takes us to the Run Workflow page, where you can rerun the workflow. While running, you can change the workflow input parameters and task to domain mapping.

Rerun from Conductor UI

Retry from Failed Task

Suppose your workflow fails at a task; you can retry the workflow from the failed task.

Using API

Once you have the workflowId, you can retry a failed workflow from the failed task using the following API.

POST /workflow/{workflowId}/retry

SDKs

BulkResponse retryWorkflow(List<String> workflowIds) throws ApiException

From Conductor UI

From the workflow executions page, click Actions, and choose Retry - From failed task.

Retry from Conductor UI

Manually Updating Task Status in a Workflow

Certain situations may require you to manually update the task status in a workflow.

Using API

By providing the workflowId, task reference name, and the task status as the input, you can use the following API to update a task status manually:

POST /tasks/{workflowId}/{taskRefName}/{status}

SDKs

String OrkesTaskClient.updateTaskByRefName(Map<String, Object> output, String workflowId, String taskRefName, String status) throws ApiException

Using Conductor UI

  • Navigate to the workflow execution, and click on the task whose status is to be updated manually.
  • From the summary tab, select the status under the field Update task.

Manually completing the task from Conductor UI

Terminate Workflow

In certain situations, you may want to send signals to terminate the workflows.

Using API

Use the following API with the workflowId as the input parameter to terminate your running workflow:

DELETE /workflow/{workflowId}

SDKs

void terminateWorkflow(String workflowId, String reason)

Using Conductor UI

From the workflow executions page, click Actions > Terminate.

Terminating Workflow from Conductor UI