Skip to main content

spawn

Function spawn 

Source
pub fn spawn(
    engine: &impl EngineHandle,
    recording: &mut ChildWorkflowRecordingContext,
    child_type: impl Into<String>,
    input: Payload,
    child_workflow_id: WorkflowId,
    package_version: PackageVersion,
) -> Result<SpawnedChildWorkflow, ChildWorkflowError>
Expand description

Records ChildWorkflowStarted in the parent’s history, then requests the child start.

The caller pre-allocates child_workflow_id (recorded nondeterminism: drawn once on the live path, returned from history on replay) and it is recorded durably before AE is asked to start the child, so the start is exactly-once recoverable: replay resolves the spawn from the recorded event, and a crash before the child process exists is repaired by the startup recovery sweep from the same record.

§Errors

Returns ChildWorkflowError if the parent recorder rejects the start event, AE cannot start the child, or AE starts the child under a different identifier than the recorded one. A failure after the record leaves the durable ChildWorkflowStarted in place by design.