Module ebus_supervisor_spec

Utility module to create supervisor and worker specs.

Description

Utility module to create supervisor and worker specs.

Function Index

supervise/2 Receives a list of children (workers or supervisors) to supervise and a set of options.
supervisor/2Equivalent to supervisor(Module, Args, []).
supervisor/3 Defines the given Module as a supervisor which will be started with the given arguments.
worker/2Equivalent to worker(Module, Args, []).
worker/3 Defines the given Module as a worker which will be started with the given arguments.

Function Details

supervise/2

supervise(Children::[supervisor:child_spec()], SupFlags::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}).

supervisor/2

supervisor(Module, Args) -> any()

Equivalent to supervisor(Module, Args, []).

supervisor/3

supervisor(Module::module(), Args::[term()], Spec::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]
  }

worker/2

worker(Module, Args) -> any()

Equivalent to worker(Module, Args, []).

worker/3

worker(Module::module(), Args::[term()], Spec::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]
  }


Generated by EDoc