Skip to main content

atomr_patterns/cqrs/
mod.rs

1//! CQRS + Event Sourcing pattern.
2//!
3//! `CqrsPattern` wires up the four moving parts of a typical
4//! command-query stack:
5//!
6//! 1. A **command gateway** actor that owns one
7//!    [`crate::AggregateRoot`] instance per aggregate id and persists
8//!    events through the configured [`atomr_persistence::Journal`].
9//! 2. A **repository** handle that callers use to dispatch commands.
10//! 3. Zero or more **readers** — async tasks that follow the
11//!    [`atomr_persistence_query::ReadJournal`], decode events with the
12//!    user-supplied codec, and fold them into projection state.
13//! 4. **Extension hooks** — pre-handler interceptors (validation,
14//!    authorization), post-persist event listeners, and async event
15//!    taps that bridge to [`atomr_streams`] / external systems.
16//!
17//! See [`CqrsPattern::builder`] for the entry point.
18
19pub mod audit;
20mod builder;
21mod command_gateway;
22mod event_codec;
23mod projection;
24mod reader;
25mod scheduled;
26
27pub use audit::{AuditLog, AuditProjection};
28pub use builder::{CqrsBuilder, CqrsHandles, CqrsPattern, CqrsTopology};
29pub use event_codec::EventCodecRegistry;
30pub use projection::ProjectionHandle;
31pub use reader::{Reader, ReaderFilter};
32pub use scheduled::schedule_command;