Skip to main content

Signal

A Signal is a message that can be sent into a running workflow execution. The workflow can use signals to wait for input from an external system, for example waiting for another service to send a signal indicating a user has confirmed/denied a request.

Signals are a point-to-point communication mechanism, which is different than an Event which are broadcasted by emitted to subscribers.

Create a Signal

To create a Signal, import and call the signal function available in @eventual/core

import { signal } from "@eventual/core";

const mySignal = signal("signal-name");

Specify a Signal's payload type

Signals can have payloads. To specify a Signal's type, use the <Type> syntax when creating it:

const mySignal = signal<boolean>("isConfirmed");

Send a Signal to a running execution

To send a Signal to a running workflow execution, you need its executionId:

Using an executionId, you can call the sendSignal method on a Signal instance, passing the executionId and optional payload:

await mySignal.sendSignal({
executionId: "my-execution-id",
payload: true,
});

Also see the ExecutionHandle.sendSignal and EventualClient.sendSignal documentation for alternative methods of sending a signal.

Wait for a Signal in a Workflow

See the Workflow Documentation.