Created: 2011-07-12 18:25
Updated: 2017-11-13 14:02


esupervisor is an extension of Erlang's supervisor API that makes it more convenient.


  • record-based syntax

It allows you to avoid problems with the need to follow the exact order of elements in supervisor tuples so that you don't have to use (often) inconsistent CHILD macros and yet describe your supervision items at any level of detail you want

  • single callback to describe the entire supervision tree

Instead of scattering your supervision tree across multiple sup modules you can have a clear view of your entire supervision tree in a single module because esupervisor allows you to specify supervisors as children.


Define your supervisor:


%% API

%% Supervisor callbacks

start_link() ->
    esupervisor:start_link({local, ?MODULE}, ?MODULE, []).

Define your supervision tree:

init([]) ->
      children = [
                     id = first 
                                id = some_sup,
                                registered = some_sup,
                                children = [
                                               id = some,
                                               restart = permanent,
                                               start_func = {some_worker, start_link, []}

The above example will define a one_for_one supervisor supervising two other supervisors, first and some_sup (registered as some_sup), and some_sup sofo supervisor supervises worker processes that are started with some_worker:start_link.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more