Supervision Is the Basis of Reliability

Let’s briefly recap. In that last example, we ran our OTP sequence application using mix. Looking at just our code, we see that two supervisor processes and two worker processes got started. These were knitted together so our system continued to run with no loss of state even if the worker that we talked to crashed. And any other Erlang process on this node (including iex itself) can talk to our sequence application and enjoy its stream of freshly minted integers.

You probably noticed that the start function takes two parameters. The second corresponds to the value we specified in the mod: option in the mix.exs file (in our case, the counter’s initial value). The first parameter specifies the status of ...

Get Programming Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.