Skip to Main Content
Mastering Elixir
book

Mastering Elixir

by André Albuquerque, Daniel Caixinha
July 2018
Intermediate to advanced content levelIntermediate to advanced
574 pages
14h 7m
English
Packt Publishing
Content preview from Mastering Elixir

Starting children at runtime using dynamic supervisors

We've now seen how we can work with supervisors to recover from errors, which will restart crashed processes according to the configuration we provide. However, so far we have to define the children of a supervisor up front, which will be started right after the supervisor starts. Sometimes this doesn't fit our needs, and we need a way to spawn a new child of a supervisor at runtime. This is where dynamic supervisors become useful.

Elixir Version 1.6 introduced the DynamicSupervisor module. As we've stated, this new module deprecates the :simple_one_for_one strategy of regular supervisors. There were many reasons for this extraction to happen, but two of the main ones are that the :simple_one_for_one ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Testing Elixir

Testing Elixir

Andrea Leopardi, Jeffrey Matthias

Publisher Resources

ISBN: 9781788472678Supplemental Content