Skip to main content

OutboxManagerBuilder

Struct OutboxManagerBuilder 

Source
pub struct OutboxManagerBuilder<S, P, PT>
where PT: Debug + Clone + Serialize,
{ /* 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:

  • SOutboxStorage implementation (typically a database adapter)
  • PTransport implementation (message broker publisher)
  • PT — the user’s domain event payload type (Debug + Clone + Serialize)

§Required vs optional

SetterRequiredNotes
storageyesfails build() if missing
publisheryesfails build() if missing
configyesfails build() if missing
shutdown_rxyesfails build() if missing
dlq_heapyes (feature dlq only)fails build() if missing when feature is on

Implementations§

Source§

impl<S, P, PT> OutboxManagerBuilder<S, P, PT>
where S: OutboxStorage<PT> + Send + Sync + 'static, P: Transport<PT> + Send + Sync + 'static, PT: Debug + Clone + Serialize + Send + Sync + 'static,

Source

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.

Source

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.

Source

pub fn publisher(self, p: Arc<P>) -> Self

Sets the transport (broker publisher) that delivers events to the outside world.

Source

pub fn config(self, config: Arc<OutboxConfig<PT>>) -> Self

Sets the runtime configuration (batch size, poll interval, GC cadence, lock timeout, idempotency strategy).

Source

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.

Source

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 dlqDlq heap.

Trait Implementations§

Source§

impl<S, P, PT> Default for OutboxManagerBuilder<S, P, PT>
where PT: Debug + Clone + Serialize,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S, P, PT> Freeze for OutboxManagerBuilder<S, P, PT>

§

impl<S, P, PT> RefUnwindSafe for OutboxManagerBuilder<S, P, PT>

§

impl<S, P, PT> Send for OutboxManagerBuilder<S, P, PT>
where S: Sync + Send, P: Sync + Send,

§

impl<S, P, PT> Sync for OutboxManagerBuilder<S, P, PT>
where S: Sync + Send, P: Sync + Send,

§

impl<S, P, PT> Unpin for OutboxManagerBuilder<S, P, PT>

§

impl<S, P, PT> UnsafeUnpin for OutboxManagerBuilder<S, P, PT>

§

impl<S, P, PT> UnwindSafe for OutboxManagerBuilder<S, P, PT>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more