This commit is contained in:
2026-02-15 13:55:39 +08:00
parent 7811a9ad48
commit a116598698
5 changed files with 97 additions and 8 deletions

17
lib/manager.ex Normal file
View File

@@ -0,0 +1,17 @@
defmodule Manager do
use DynamicSupervisor
def start_link(init_arg) do
DynamicSupervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
end
@impl true
def init(_init_arg) do
DynamicSupervisor.init(strategy: :one_for_one)
end
def create_broker(port) do
spec = {Broker, port}
DynamicSupervisor.start_child(__MODULE__, spec)
end
end