DynamicSupervisor of per-task-queue Hourglass.Worker GenServers.
Bridge-handle lifecycle is managed inside Hourglass.Worker
itself: init/1 calls BridgeHolder.register_worker/2,
terminate/2 calls BridgeHolder.unregister_worker/1. This module
is a thin wrapper that supports adding and removing Workers
dynamically (e.g. one per Temporal task queue the application
serves).
Summary
Functions
Returns a specification to start this module under a supervisor.
Start a Worker child for opts[:task_queue]. The Worker's init/1
registers a bridge handle via BridgeHolder and starts the inner
poll-loop Supervisor.
Stop the Worker for task_queue. Looks the Worker pid up via
WorkerRegistry, terminates its child entry under this DynSup
(which runs Worker.terminate/2, calling
BridgeHolder.unregister_worker/1 along the way). If the Worker
isn't registered, defensively unregister the bridge handle anyway
(idempotent) and return {:error, :not_found}.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(term()) :: Supervisor.on_start()
@spec start_worker(keyword()) :: DynamicSupervisor.on_start_child()
Start a Worker child for opts[:task_queue]. The Worker's init/1
registers a bridge handle via BridgeHolder and starts the inner
poll-loop Supervisor.
@spec stop_worker(String.t()) :: :ok | {:error, :not_found}
Stop the Worker for task_queue. Looks the Worker pid up via
WorkerRegistry, terminates its child entry under this DynSup
(which runs Worker.terminate/2, calling
BridgeHolder.unregister_worker/1 along the way). If the Worker
isn't registered, defensively unregister the bridge handle anyway
(idempotent) and return {:error, :not_found}.