pub struct OutboxManagerBuilder<S, P, PT>{ /* private fields */ }Expand description
Fluent builder that assembles an OutboxManager.
All fields are optional during construction — validation happens once in
build. Setter methods consume and return self, so a
builder can be constructed in a single chained expression. The builder is
generic over:
S—OutboxStorageimplementation (typically a database adapter)P—Transportimplementation (message broker publisher)PT— the user’s domain event payload type (Debug + Clone + Serialize)
§Required vs optional
| Setter | Required | Notes |
|---|---|---|
storage | yes | fails build() if missing |
publisher | yes | fails build() if missing |
config | yes | fails build() if missing |
shutdown_rx | yes | fails build() if missing |
dlq_heap | yes (feature dlq only) | fails build() if missing when feature is on |
Implementations§
Source§impl<S, P, PT> OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> OutboxManagerBuilder<S, P, PT>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty builder with all fields unset.
Equivalent to Default::default; kept as a discoverable entry point
so callers do not need to import the Default trait.
Sourcepub fn storage(self, s: Arc<S>) -> Self
pub fn storage(self, s: Arc<S>) -> Self
Sets the storage backend used for reading pending events, locking them, persisting status transitions, and deleting expired rows.
Sourcepub fn publisher(self, p: Arc<P>) -> Self
pub fn publisher(self, p: Arc<P>) -> Self
Sets the transport (broker publisher) that delivers events to the outside world.
Sourcepub fn config(self, config: Arc<OutboxConfig<PT>>) -> Self
pub fn config(self, config: Arc<OutboxConfig<PT>>) -> Self
Sets the runtime configuration (batch size, poll interval, GC cadence, lock timeout, idempotency strategy).
Sourcepub fn shutdown_rx(self, rx: Receiver<bool>) -> Self
pub fn shutdown_rx(self, rx: Receiver<bool>) -> Self
Sets the shutdown channel. The manager stops its worker loop as soon as
true is observed on this receiver.
Sourcepub fn build(self) -> Result<OutboxManager<S, P, PT>, OutboxError>
pub fn build(self) -> Result<OutboxManager<S, P, PT>, OutboxError>
Consumes the builder and returns a fully wired OutboxManager.
§Errors
Returns OutboxError::ConfigError with a message identifying the
first missing dependency if any required field has not been set.
The diagnostic mentions one of: Storage, Publisher, Config,
Shutdown channel, or — under feature dlq — Dlq heap.