Terminates a running workflow job by its ID. The target job's status
is set to an error code indicating abnormal termination, and any
pending activities or timers are cancelled.
This is the workflow-internal terminate — it can only be called from
within a workflow function. For external termination, use
handle.terminate() directly.
The terminate fires exactly once per workflow execution — the
isSideEffectAllowed guard prevents re-terminating on replay.
Examples
import { Durable } from'@hotmeshio/hotmesh';
// Terminate a child workflow from the parent exportasyncfunctionsupervisorWorkflow(): Promise<void> { constchildId = awaitDurable.workflow.startChild({ taskQueue:'workers', workflowName:'longTask', args: [], });
// Wait for a timeout, then terminate the child awaitDurable.workflow.sleep('5 minutes'); awaitDurable.workflow.terminate(childId, { reason:'Timed out waiting for child', descend:true, // also terminate any grandchild workflows }); }
Terminates a running workflow job by its ID. The target job's status is set to an error code indicating abnormal termination, and any pending activities or timers are cancelled.
This is the workflow-internal terminate — it can only be called from within a workflow function. For external termination, use
handle.terminate()directly.The terminate fires exactly once per workflow execution — the
isSideEffectAllowedguard prevents re-terminating on replay.Examples