Skip to content
Edvard Fonsell edited this page Mar 30, 2017 · 1 revision

Workflow signal is a mechanism to notify workflow instance while it is executing a state method. The execution is not interrupted by setting a signal but the state method implementation can check the signal value and implement some logic based on that if necessary. For example, a long running state method that executes operations in a loop may be "interrupted" by checking if the signal has been set and moving to another state if necessary.

Workflow signal can be set or cleared via StateExecution.setSignal, WorkflowInstanceService.setSignal and nFlow REST API (PUT /nflow/v1/workflow-instance/{id}/signal). The current value of the signal is available via StateExecution.getSignal, WorkflowInstanceService.getSignal and nFlow REST API (signal property of the JSON object returned by GET /nflow/v1/workflow-instance/{id}). The signal value is always written and read from the database immediately - in contrast to state variables that are read when the state method execution starts, written when the execution ends and cannot be modified outside the state method while the workflow instance is executing.