jkmrto / dynamic-superisor-with-registry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DynamicSupervisorWithRegistry

Dynamic Supervisor with Registry simple example.

Installation

mix deps.get
mix deps.compile
mix compile

To run in interactve mode

iex -S mix

Start three workers:

alias DynamicSupervisorWithRegistry.WorkersSupervisor
WorkersSupervisor.start_child("worker_1")
WorkersSupervisor.start_child("worker_2")
WorkersSupervisor.start_child("worker_3")
:observer.start()

Stopping worker:

alias DynamicSupervisorWithRegistry.Worker
Worker.stop("worker_1")

Crashing a worker:

alias DynamicSupervisorWithRegistry.Worker
Worker.crash("worker_2")

About


Languages

Language:Elixir 100.0%