Interface: ChildWorkflowHandle<T>
workflow.ChildWorkflowHandle
A client side handle to a single Workflow instance. It can be used to signal, wait for completion, and cancel a Workflow execution.
Given the following Workflow definition:
export const incrementSignal = defineSignal('increment');
export async function counterWorkflow(initialValue: number): Promise<void>;
Start a new Workflow execution and get a handle for interacting with it:
// Start the Workflow with initialValue of 2.
const handle = await startWorkflow(counterWorkflow, { args: [2] });
await handle.signal(incrementSignal, 2);
await handle.result(); // throws WorkflowExecutionTerminatedError
Type parameters
Name | Type |
---|---|
T | extends Workflow |
Hierarchy
-
↳
ChildWorkflowHandle
Properties
firstExecutionRunId
• Readonly
firstExecutionRunId: string
The runId of the initial run of the bound Workflow
workflowId
• Readonly
workflowId: string
The workflowId of the current Workflow
Inherited from
Methods
result
▸ result(): Promise
<WorkflowResultType
<T
>>
Promise that resolves when Workflow execution completes
Returns
Promise
<WorkflowResultType
<T
>>
Inherited from
signal
▸ signal<Args
, Name
>(def
, ...args
): Promise
<void
>
Signal a running Workflow.
Type parameters
Name | Type |
---|---|
Args | extends any [] = [] |
Name | extends string = string |
Parameters
Name | Type | Description |
---|---|---|
def | string | SignalDefinition <Args , Name > | a signal definition as returned from defineSignal |
...args | Args | - |
Returns
Promise
<void
>
Example
await handle.signal(incrementSignal, 3);