Pauses the workflow until a signal with the given signalId is received.
The workflow suspends durably — it survives process restarts and will
resume exactly once when the matching signal() call delivers data.
waitFor is the receive side of the signal coordination pair.
The send side is signal(), which can be called from another
workflow, a hook function, or externally via Durable.Client.workflow.signal().
On replay, waitFor returns the previously stored signal payload
immediately (no actual suspension occurs).
// Paired with hook: spawn work and wait for the result exportasyncfunctionorchestrator(input: string): Promise<string> { constsignalId = `result-${Durable.workflow.random()}`;
// Spawn a hook that will signal back when done awaitDurable.workflow.hook({ taskQueue:'processors', workflowName:'processItem', args: [input, signalId], });
// Wait for the hook to signal completion returnawaitDurable.workflow.waitFor<string>(signalId); }
Type Parameters
T
The type of data expected in the signal payload.
Parameters
signalId: string
A unique signal identifier shared by the sender and receiver.
Pauses the workflow until a signal with the given
signalIdis received. The workflow suspends durably — it survives process restarts and will resume exactly once when the matchingsignal()call delivers data.waitForis the receive side of the signal coordination pair. The send side issignal(), which can be called from another workflow, a hook function, or externally viaDurable.Client.workflow.signal().On replay,
waitForreturns the previously stored signal payload immediately (no actual suspension occurs).Examples