View Source ebus_supervisor_spec (ebus v0.3.0)
Link to this section Summary
Functions
Receives a list of children (workers or supervisors) to supervise and a set of options. Returns a tuple containing the supervisor specification.
Equivalent to supervisor(Module, Args, []).
Defines the given Module as a supervisor which will be started with the given arguments.
Equivalent to worker(Module, Args, []).
Defines the given Module as a worker which will be started with the given arguments.
Link to this section Functions
-spec supervise([supervisor:child_spec()], supervisor:sup_flags()) -> {ok, tuple()}.
Receives a list of children (workers or supervisors) to supervise and a set of options. Returns a tuple containing the supervisor specification.
Example:
ebus_supervisor_spec:supervise(Children, #{strategy => one_for_one}).
Equivalent to supervisor(Module, Args, []).
-spec supervisor(module(), [term()], map()) -> supervisor:child_spec().
Defines the given Module as a supervisor which will be started with the given arguments.
Example:
ebus_supervisor_spec:supervisor(my_sup, [], #{restart => permanent}).By default, the function start_link is invoked on the given module. Overall, the default values for the options are:
#{
id => Module,
start => {Module, start_link, Args},
restart => permanent,
shutdown => infinity,
modules => [module]
}
Equivalent to worker(Module, Args, []).
-spec worker(module(), [term()], map()) -> supervisor:child_spec().
Defines the given Module as a worker which will be started with the given arguments.
Example:
ebus_supervisor_spec:worker(my_module, [], #{restart => permanent}).By default, the function start_link is invoked on the given module. Overall, the default values for the options are:
#{
id => Module,
start => {Module, start_link, Args},
restart => permanent,
shutdown => 5000,
modules => [module]
}