PhoenixMicro.Supervisor.ConsumerManager (PhoenixMicro v1.0.0)

Copy Markdown View Source

DynamicSupervisor that manages all registered consumer worker processes. Consumers are registered either:

  1. Statically via PhoenixMicro.register_consumer/1 at app start.
  2. Dynamically at runtime via PhoenixMicro.Supervisor.ConsumerManager.start_consumer/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns a list of all running consumer modules.

Starts the processing pipeline for the given consumer module.

Stops a running consumer (works for both Broadway and Worker modes).

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

running_consumers()

@spec running_consumers() :: [module()]

Returns a list of all running consumer modules.

start_consumer(consumer_module)

@spec start_consumer(module()) :: DynamicSupervisor.on_start_child()

Starts the processing pipeline for the given consumer module.

Chooses between PhoenixMicro.Pipeline (Broadway-backed, default) and the legacy PhoenixMicro.Consumer.Worker (Task-based) depending on the consumer's pipeline setting:

pipeline :broadway   # default — full backpressure, batch support
pipeline :simple     # legacy — Task.start dispatch

Idempotent — if the consumer is already running, returns {:ok, pid}.

start_link(opts \\ [])

@spec start_link(keyword()) :: Supervisor.on_start()

stop_consumer(consumer_module)

@spec stop_consumer(module()) :: :ok | {:error, :not_found}

Stops a running consumer (works for both Broadway and Worker modes).