Defining the supervisor functions

Given that all the hard work has already been done in the previous sections, we just need to inject in the caller module the start_link/0 and init/1 functions, so it can be started as a normal supervisor:

$ cat apps/elixir_drip/lib/elixir_drip/dsl/pipeliner.exdefmodule ElixirDrip.Pipeliner do  import Supervisor.Spec  # ...  defmacro __using__(opts) do    # ...    IO.puts "Building Pipeliner: #{name}"    quote do      # ...      Module.register_attribute(__MODULE__, :pipeline_steps,       accumulate: true)      @before_compile unquote(__MODULE__)      def start_link(),        do: Supervisor.start_link(__MODULE__, [], name: unquote(name))      def init(_) do        worker_specs_to_start = get_pipeline_steps()                                |> pipeline_specs()        Supervisor.init( worker_specs_to_start, ...

Get Mastering 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.