Tasklet-requested spawn of a steps instance: the request a tasklet makes
with Flezha.SDK.Ctx.spawn_steps/4, the handle it gets back at once, and
what the controller's answer resolves to.
The request is flz_core's, made from the invocation's live activation, and
the handle is the core's: it is read inside the invocation that made it, and
released when that invocation's activation completes. A failure nobody read
is logged once by the core. Nothing here faults the invocation: every
refusal resolves the handle. The contract is docs/public/topics/core/workflows.md.
Summary
Types
What a running instance id gets: the payload, or already_running.
id: names the instance; without it the controller generates one and the
request always starts a new instance. if_running: needs an id: (the core
refuses it without one, spawn.if_running_without_id) and defaults to
:deliver.
What a handle resolves to: the instance reached, or the refusal, carrying
the controller's own code (relay.already_running, relay.factory_unknown,
...) or the core's (spawn.timeout, spawn.unavailable).
A request's handle: the core's handle number, or the result known without
asking (a refusal at the call).
Functions
Wait for the answer, up to timeout milliseconds; spawn.timeout when
nothing arrived.
The answer if it has arrived, else :pending, without waiting.
Types
@type if_running() :: :deliver | :error
What a running instance id gets: the payload, or already_running.
@type option() :: {:id, String.t()} | {:if_running, if_running()}
id: names the instance; without it the controller generates one and the
request always starts a new instance. if_running: needs an id: (the core
refuses it without one, spawn.if_running_without_id) and defaults to
:deliver.
@type result() :: {:ok, %{id: String.t(), outcome: :spawned | :delivered | :skipped_on_replay}} | {:error, Flezha.SDK.Error.t()}
What a handle resolves to: the instance reached, or the refusal, carrying
the controller's own code (relay.already_running, relay.factory_unknown,
...) or the core's (spawn.timeout, spawn.unavailable).
@type t() :: %Flezha.SDK.Spawn{ core: term(), factory_id: term(), handle: term(), instance_id: term(), result: term() }
A request's handle: the core's handle number, or the result known without
asking (a refusal at the call).
Functions
@spec await(t(), non_neg_integer()) :: result()
Wait for the answer, up to timeout milliseconds; spawn.timeout when
nothing arrived.
The answer if it has arrived, else :pending, without waiting.