defmodule Gullintanni.Pipeline.Supervisor do
  use Supervisor

  def start_link do
    Supervisor.start_link(__MODULE__, [], name: __MODULE__)
  end

  def start_pipeline(config) do
    Supervisor.start_child(__MODULE__, [config])
  end

  def init(_) do
    children = [
      worker(Gullintanni.Pipeline, [], restart: :transient)
    ]

    supervise(children, strategy: :simple_one_for_one)
  end
end

alias Experimental.DynamicSupervisor

defmodule Gullintanni.Pipeline.Supervisor do
  use DynamicSupervisor

  def start_link do
    DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
  end

  def start_pipeline(config) do
    DynamicSupervisor.start_child(__MODULE__, [config])
  end

  def init(_) do
    children = [
      worker(Gullintanni.Pipeline, [], restart: :transient)
    ]

    {:ok, children, strategy: :one_for_one}
  end
end

Use the new DynamicSupervisor instead of :simple_one_for_one
Use the new DynamicSupervisor instead of :simple_one_for_one

This is the interface that will be used in Elixir in the near future.

See: https://github.com/elixir-lang/gen_stage/issues/12

gullintanni/gullintanni,gullintanni/gullintanni