HareMq.DynamicSupervisor
(hare_mq v1.4.0)
Copy Markdown
Per-module dynamic supervisor for HareMq.DynamicConsumer worker pools.
Each module that use HareMq.DynamicConsumer gets its own supervisor
registered as :<ModuleName>.Supervisor (e.g. MyApp.Consumer.Supervisor).
This allows multiple consumer modules to coexist on the same node without
name conflicts.
Worker processes are started asynchronously (unlinked Task) so a startup
failure (e.g. transient connection error) does not crash the supervisor.
Summary
Functions
Adds a new consumer worker to the running pool.
Returns a specification to start this module under a supervisor.
Initializes the dynamic supervisor.
Returns all child specs currently managed by supervisor.
Gracefully removes a running consumer by global name.
Starts the AutoScaler as a child under this DynamicSupervisor.
Starts a child worker under supervisor.
Returns the registered atom name for the supervisor managing module_name.
Functions
Adds a new consumer worker to the running pool.
Delegates to start_child/2. Useful when the auto-scaler scales up.
Returns a specification to start this module under a supervisor.
See Supervisor.
Initializes the dynamic supervisor.
Spawns an unlinked Task to start consumers and (if configured) the
auto-scaler. Using an unlinked task means transient errors during consumer
startup (e.g. waiting for a connection) do not crash the supervisor.
Returns all child specs currently managed by supervisor.
Gracefully removes a running consumer by global name.
Sends :cancel_consume to allow the consumer to finish its current message,
then terminates the process under the given supervisor.
Returns :ok immediately if the named process is not found.
Starts the AutoScaler as a child under this DynamicSupervisor.
Starts a child worker under supervisor.
supervisor— the name returned bysupervisor_name/1.worker:— the worker module (must implementstart_link/1).name:— global registration name string for the worker.opts:— options forwarded to the worker'sstart_link.
Returns the registered atom name for the supervisor managing module_name.
Example
HareMq.DynamicSupervisor.supervisor_name(MyApp.Consumer)
# => :"MyApp.Consumer.Supervisor"