pub struct OutboxProcessor<S, T, P>{ /* private fields */ }Expand description
Processes one batch of pending outbox events per invocation.
Holds handles to storage, transport, and configuration; the manager constructs a single processor at startup and reuses it across iterations.
Implementations§
Source§impl<S, T, P> OutboxProcessor<S, T, P>
impl<S, T, P> OutboxProcessor<S, T, P>
Sourcepub fn new(
storage: Arc<S>,
publisher: Arc<T>,
config: Arc<OutboxConfig<P>>,
) -> Self
pub fn new( storage: Arc<S>, publisher: Arc<T>, config: Arc<OutboxConfig<P>>, ) -> Self
Creates a processor wired to the supplied storage, transport, and configuration.
Sourcepub async fn process_pending_events(
&self,
dlq_heap: Arc<dyn DlqHeap>,
) -> Result<usize, OutboxError>
pub async fn process_pending_events( &self, dlq_heap: Arc<dyn DlqHeap>, ) -> Result<usize, OutboxError>
Processes one batch of pending events.
Fetches up to config.batch_size rows via
OutboxStorage::fetch_next_to_process, publishes each through the
Transport, and then marks every successfully published row as
Sent in a single
update_status call. Rows whose
publish call failed are left in Processing; their lock will expire
and make them eligible for retry.
Returns the number of events fetched in the batch — 0 signals to the
caller (typically the manager’s drain loop) that there is nothing left
to do right now and it can go back to waiting.
When the dlq feature is enabled, takes a shared
DlqHeap and records success or
failure per event so the heap can track repeat-offender rows.
§Errors
Returns a DatabaseError propagated from
fetch_next_to_process or update_status. Per-event publish failures
are not propagated — they are logged via tracing::error! and the
rest of the batch continues.
Auto Trait Implementations§
impl<S, T, P> !RefUnwindSafe for OutboxProcessor<S, T, P>
impl<S, T, P> !UnwindSafe for OutboxProcessor<S, T, P>
impl<S, T, P> Freeze for OutboxProcessor<S, T, P>
impl<S, T, P> Send for OutboxProcessor<S, T, P>
impl<S, T, P> Sync for OutboxProcessor<S, T, P>
impl<S, T, P> Unpin for OutboxProcessor<S, T, P>
impl<S, T, P> UnsafeUnpin for OutboxProcessor<S, T, P>
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