ExESDB.Commanded.AggregateListener (ex_esdb_commanded v0.9.0)
A process that subscribes to the EventStore's Phoenix PubSub <store>:$all topic
and filters events by stream_id for aggregate transient subscriptions.
Simplified with Swarm for process distribution.
Each AggregateListener processes:
- Subscribes to the
<store>:$allPhoenix PubSub topic - Filters incoming events based on the target stream_id
- Transforms ExESDB.Schema.EventRecord to Commanded.EventStore.RecordedEvent
- Forwards matching events to the subscriber process
Summary
Functions
Returns a specification to start this module under a supervisor.
Gets the PID of the AggregateListener for a given store_id and stream_id.
Starts an AggregateListener without linking to the calling process. Useful for transient subscriptions where we don't want to crash the caller.
Starts an AggregateListener for the given stream using Swarm.
Stops the AggregateListener process.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Gets the PID of the AggregateListener for a given store_id and stream_id.
@spec start(listener_config()) :: {:ok, pid()} | {:error, term()}
Starts an AggregateListener without linking to the calling process. Useful for transient subscriptions where we don't want to crash the caller.
@spec start_link(listener_config()) :: {:ok, pid()} | {:error, term()}
Starts an AggregateListener for the given stream using Swarm.
Parameters
- config: Map containing:
- store_id: The EventStore identifier
- stream_id: The target stream to filter events for
- subscriber: The process to send filtered events to
- replay_historical_events?: Whether to replay historical events on startup (defaults to true)
@spec stop(pid()) :: :ok
Stops the AggregateListener process.