Skip to main content

PushNotificationDelivery

Trait PushNotificationDelivery 

Source
pub trait PushNotificationDelivery: Send + Sync {
    // Required method
    fn deliver(
        &self,
        config: &NotificationConfig,
        body: &[u8],
    ) -> impl Future<Output = Result<(), NotificationConfigError>> + Send;
}
Expand description

The port the push-notification handler depends on.

An implementation is HttpPushNotificationDelivery (in adapters/secondary/a2a/); a test implementation is a closure or a Vec<NotificationConfig> in-memory recorder. The handler is none the wiser.

Required Methods§

Source

fn deliver( &self, config: &NotificationConfig, body: &[u8], ) -> impl Future<Output = Result<(), NotificationConfigError>> + Send

Delivers one notification.

§Errors
  • NotificationConfigError::Refused if the URL filter rejects the URL at delivery time (a DNS-rebind to a denied IP, for example).
  • A network / timeout / non-2xx error if the POST failed and a retry is appropriate. The handler maps this to its own retry policy; the port deliberately returns no concrete type here so an adapter can carry a reqwest::Error (or a tokio::io::Error, or a custom error) without forcing the handler to name a third-party error type.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§