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 dlq_heap(self, heap: Arc<dyn DlqHeap>) -> Self
pub fn dlq_heap(self, heap: Arc<dyn DlqHeap>) -> Self
Sets the Dead-Letter-Queue heap that tracks per-event failure counts.
Required when the crate is built with --features dlq.
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.
Trait Implementations§
Auto Trait Implementations§
impl<S, P, PT> !RefUnwindSafe for OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> !UnwindSafe for OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> Freeze for OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> Send for OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> Sync for OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> Unpin for OutboxManagerBuilder<S, P, PT>
impl<S, P, PT> UnsafeUnpin for OutboxManagerBuilder<S, P, PT>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more