Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler: Send + Sync {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 EventEnvelope,
    ) -> Pin<Box<dyn Future<Output = HandlerOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A consumer: what the worker hands every event it subscribed to. Delivery is at-least-once, so a handler must be idempotent — the same event.id can arrive twice (ADR-0018 § 6).

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 EventEnvelope, ) -> Pin<Box<dyn Future<Output = HandlerOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§