Expand description
Push-based projection subscriptions.
This module provides continuous event subscriptions that keep projections
up-to-date as events are committed. Unlike Repository::load_projection,
which rebuilds a projection from scratch on each call, subscriptions
maintain an in-memory projection that updates in real time.
§Overview
A subscription:
- Replays historical events (catch-up phase)
- Transitions to processing live events as they are committed
- Fires callbacks on each update
§Example
ⓘ
let subscription = repository
.subscribe::<Dashboard>(())
.on_update(|dashboard| println!("{dashboard:?}"))
.start()
.await?;
// Later, shut down gracefully
subscription.stop().await?;Structs§
- Subscription
Builder - Builder for configuring and starting a subscription.
- Subscription
Handle - Handle to a running subscription.
Enums§
- Subscription
Error - Errors that can occur during subscription lifecycle.
Traits§
- Subscribable
Store - A store that supports push-based event subscriptions.
Type Aliases§
- Event
Stream - Type alias for the boxed event stream returned by
SubscribableStore::subscribe.