Packages

Seven Otters is a set of facilities (macroes, functions, modules, etc.) developed to create CQRS/ES solutions in Elixir on BEAM virtual machine.

Current section

Files

Jump to
seven lib seven process_supervisor.ex
Raw

lib/seven/process_supervisor.ex

defmodule Seven.ProcessSupervisor do
use DynamicSupervisor
def start_link(_opts), do: DynamicSupervisor.start_link(__MODULE__, :ok, name: __MODULE__)
def init(:ok), do: DynamicSupervisor.init(strategy: :one_for_one)
def start_process(handler, process_id, opts) do
spec = %{id: handler, start: {handler, :start_link, [process_id, opts]}, restart: :transient}
DynamicSupervisor.start_child(__MODULE__, spec)
end
end