This shows you the differences between two versions of the page.
cs330_f2016:lab13supervisortree [2017/03/22 22:38] dhart created |
cs330_f2016:lab13supervisortree [2021/06/30 23:42] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | <file elixir sample_supervisor.exs> | ||
- | defmodule ExampleSuper do | ||
- | use Supervisor | ||
- | |||
- | def start_link(ns) do | ||
- | Supervisor.start_link(__MODULE__, ns ) | ||
- | end | ||
- | |||
- | def init(ns) do | ||
- | children = [ | ||
- | worker(Database, [ns]), | ||
- | worker(CustomerService, [ns]), | ||
- | worker(Info, [ns]), | ||
- | worker(Shipper, [ns]), | ||
- | worker(User, [ns]), | ||
- | worker(Order, [ns]) | ||
- | ] | ||
- | |||
- | supervise(children, strategy: :one_for_all) | ||
- | end | ||
- | end | ||
- | |||
- | </file> |