Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Created September 29, 2015 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shankardevy/a4dfa3eb10d94485b79a to your computer and use it in GitHub Desktop.
Save shankardevy/a4dfa3eb10d94485b79a to your computer and use it in GitHub Desktop.
Where to add the event handlers?
defmodule KV.Supervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, :ok)
end
@manager_name KV.EventManager
@registry_name KV.Registry
def init(:ok) do
children = [
worker(GenEvent, [[name: @manager_name]]),
worker(KV.Registry, [@manager_name, [name: @registry_name]])
]
supervise(children, strategy: :one_for_one)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment