How to run an Erlang application under the supervisor

330 views Asked by At

What does it mean to run an Erlang application under the supervisor? If there are any examples how to make it, could you please show it.

1

There are 1 answers

3
ldx On

It means you should create a top level supervisor that makes sure parts of your application are restarted if they crash.

The exact topology of your application depends on what you're trying to do (how many processes, what they do and what their relationship is). For applications that are not trivial you might want to create a top level supervisor and then further supervisors responsible for the different processes or process groups.

The most common for simple applications is to create an application, and to make your application start a supervisor which in turn starts up one or more worker children. If you use rebar to create your project that will by default create the stubs for this.