Skip to main content

NotificationDelivery

Trait NotificationDelivery 

Source
pub trait NotificationDelivery: Send + Sync {
    // Required method
    fn deliver<'life0, 'life1, 'async_trait>(
        &'life0 self,
        notification: &'life1 PendingNotification,
    ) -> Pin<Box<dyn Future<Output = DeliveryOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn consumer(&self) -> &str { ... }
}
Expand description

What a notification module implements: perform one request.

The dispatcher calls it with the request claimed and a database transaction open (see the module guarantees), so keep it to the provider call: it holds a pool connection until it answers. It must not stage rows on the dispatcher’s behalf; to record that something was sent it writes through its own service, inside the correlation the dispatcher bound.

Required Methods§

Source

fn deliver<'life0, 'life1, 'async_trait>( &'life0 self, notification: &'life1 PendingNotification, ) -> Pin<Box<dyn Future<Output = DeliveryOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform notification.

Provided Methods§

Source

fn consumer(&self) -> &str

The name this delivery claims requests under in the inbox. Two deliveries that must each handle every request (a mail module and an audit mirror) name themselves apart; a single delivery keeps the default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§