Skip to main content

hexeract_outbox/
lib.rs

1//! Transactional outbox primitives for the Hexeract messaging framework.
2//!
3//! The outbox pattern stores outgoing domain events in the same database
4//! transaction as the business state mutation, then a worker polls the
5//! table and dispatches each row to its registered handler. This crate
6//! ships the backend-agnostic primitives: the [`Event`] marker trait, the
7//! persisted [`OutboxEnvelope`] row representation, and the unified
8//! [`OutboxError`] type.
9//!
10//! Backend implementations live in companion crates such as
11//! `hexeract-outbox-sql`.
12
13/// Persisted representation of an event awaiting dispatch.
14pub mod envelope;
15/// Errors raised by the outbox primitives, publishers and workers.
16pub mod error;
17/// Marker trait for domain events that flow through the outbox.
18pub mod event;
19/// Asynchronous handler contract dispatched by the worker.
20pub mod handler;
21/// Backend-agnostic contract for inserting events into the outbox.
22pub mod publisher;
23/// Poll loop worker, type-erased dispatch and store abstraction.
24pub mod worker;
25
26pub use envelope::OutboxEnvelope;
27pub use error::OutboxError;
28pub use event::Event;
29pub use handler::Handler;
30pub use publisher::OutboxPublisher;
31pub use worker::{
32    BoxFuture, ErasedHandler, OutboxStore, OutboxWorker, OutboxWorkerConfig, TypedHandler,
33};