Search code examples
erlangerlang-supervisor

Erlang: cascaded supervisors?


Is it possible to cascade supervisors inside an application?

E.g. supervisor sup1 spawning a child process which creates a supervisor sup2 ?


Solution

  • You probably want to add the child as supervisor.

    It is an entry in the childspec of a child of a supervisor. The "type" of the child can be set to "supervisor":

    http://www.erlang.org/doc/design_principles/sup_princ.html#spec

    Probably you can do it via the child starting a supervisor itself too but it is at least less elegant and it is less evident what you are doing.

    HTH, h.