ExESDB.Commanded.AggregateListenerSupervisor (ex_esdb_commanded v0.1.0)

DynamicSupervisor for managing AggregateListener processes.

This supervisor is responsible for:

  1. Starting and stopping AggregateListener processes
  2. Ensuring proper supervision and restart strategies
  3. Maintaining a registry of active listeners
  4. Cleanup on application shutdown

Summary

Functions

Returns a specification to start this module under a supervisor.

Lists all active listeners with their details.

Starts a new AggregateListener under supervision.

Returns statistics about active listeners.

Stops a specific AggregateListener.

Stops all listeners for a specific store and stream combination.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

list_listeners()

@spec list_listeners() :: [
  %{
    store_id: atom(),
    stream_id: String.t(),
    subscriber: pid(),
    listener_pid: pid()
  }
]

Lists all active listeners with their details.

start_link(opts)

start_listener(config)

@spec start_listener(map()) :: {:ok, pid()} | {:error, term()}

Starts a new AggregateListener under supervision.

Returns the PID of the started listener or an error.

stats()

@spec stats() :: %{
  total_listeners: non_neg_integer(),
  listeners_by_store: %{required(atom()) => non_neg_integer()},
  active_streams: [String.t()]
}

Returns statistics about active listeners.

stop_listener(pid)

@spec stop_listener(pid()) :: :ok

Stops a specific AggregateListener.

stop_listeners_for_stream(store_id, stream_id)

@spec stop_listeners_for_stream(atom(), String.t()) :: :ok

Stops all listeners for a specific store and stream combination.