pub struct NotificationDispatcher { /* private fields */ }Expand description
The outbox relay’s sink for NotificationRequested rows: see the module docs.
Implementations§
Source§impl NotificationDispatcher
impl NotificationDispatcher
Sourcepub fn new(
pool: PgPool,
schema: impl Into<String>,
delivery: Arc<dyn NotificationDelivery>,
) -> Self
pub fn new( pool: PgPool, schema: impl Into<String>, delivery: Arc<dyn NotificationDelivery>, ) -> Self
A dispatcher for the requests staged in schema.outbox_events, claiming them in
schema.inbox_consumed on pool, and handing each to delivery.
Sourcepub fn with_retry(self, policy: RetryPolicy) -> Self
pub fn with_retry(self, policy: RetryPolicy) -> Self
Use policy for requests that answer Retry.
Sourcepub fn sink(
self: &Arc<Self>,
) -> impl Fn(OutboxRecord) -> SinkFuture + Clone + Send + Sync + 'static
pub fn sink( self: &Arc<Self>, ) -> impl Fn(OutboxRecord) -> SinkFuture + Clone + Send + Sync + 'static
The sink as a cloneable closure, in the shape backbone_outbox::runner::supervise and
relay::drain_once take.
Sourcepub async fn deliver(&self, record: OutboxRecord) -> Result<(), OutboxError>
pub async fn deliver(&self, record: OutboxRecord) -> Result<(), OutboxError>
The relay’s sink: hand record to the delivery when it is a notification request.
A record of any other type is accepted and ignored, so the sink can share a relay with other
consumers. The answer is the relay’s: Ok marks the row published (delivered, or already
delivered), OutboxError::Publish leaves it pending for the next pass (a retry, a backoff
not yet over, a database that could not be reached), OutboxError::Exhausted marks it dead
with the reason (a rejection, the retries used up, a payload that is not a request).
Auto Trait Implementations§
impl !Freeze for NotificationDispatcher
impl !RefUnwindSafe for NotificationDispatcher
impl !UnwindSafe for NotificationDispatcher
impl Send for NotificationDispatcher
impl Sync for NotificationDispatcher
impl Unpin for NotificationDispatcher
impl UnsafeUnpin for NotificationDispatcher
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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