Reactor. Process. Step. StartLink
(reactor_process v0.5.0)
View Source
A Reactor step which starts a process via it's child spec and links it to the process which is running the Reactor.
Warning
If you are building your Reactor directly (rather than via the DSL) then
this step must be added with the async?: false option otherwise the step
will fail.
The child_spec argument expects a t:Supervisor.module_spec(). The step
will then use the start MFA returned by the module's child_spec/1 function
to start the child process.
Result
The step returns a Reactor.Process.Step.StartLink.Result. The pid field
is the child process. The started? field records whether this step started
the child.
When fail_on_already_started? is false and the child is already started,
the step returns that child with started?: false. The step does not link to
it.
When fail_on_ignore? is false and the start function returns :ignore,
the step returns pid: nil and started?: false.
Undo
Undo only acts on a child that this step started. Undo does not touch a
child with started?: false.
When terminate_on_undo? is true, undo unlinks the child, sends it an exit
signal with termination_reason, and waits up to termination_timeout for
it to exit.
Arguments
:child_spec- Required. The child spec
Options
:fail_on_already_started?(boolean/0) - Whether the step should fail if the start function returns an already started error The default value istrue.:fail_on_ignore?(boolean/0) - Whether the step should fail if the start function returns:ignoreThe default value istrue.:terminate_on_undo?(boolean/0) - Whether to terminate the started process when the Reactor is undoing changes The default value istrue.:termination_reason(term/0) - The reason to give to the process when terminating it The default value is:kill.:termination_timeout(timeout/0) - How long to wait for a process to terminate The default value is5000.