Skip to main content

EventSink

Trait EventSink 

Source
pub trait EventSink: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn on_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 RazeriEvent,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventSinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventSinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Sink that receives structured events from Razeri operations.

Implementations should be non-blocking and resilient to transient failures (e.g., network issues). Razeri will continue operating even if an event sink fails.

Required Methods§

Source

fn name(&self) -> &str

Machine-readable sink name.

Source

fn on_event<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 RazeriEvent, ) -> Pin<Box<dyn Future<Output = Result<(), EventSinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle an event. Should not block or panic.

§Errors

Returns an error if the operation fails.

Source

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), EventSinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush any buffered events.

§Errors

Returns an error if the operation fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§