Skip to main content

TransportAdapter

Trait TransportAdapter 

Source
pub trait TransportAdapter: Send + Sync {
    // Required methods
    fn deliver<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        event: &'life1 SubscriptionEvent,
        subscription_name: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), SubscriptionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn name(&self) -> &'static str;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Transport adapter trait for delivering subscription events.

Transport adapters are responsible for delivering events to external systems. Each adapter implements a specific delivery mechanism (HTTP, Kafka, etc.).

§Implementors

Required Methods§

Source

fn deliver<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event: &'life1 SubscriptionEvent, subscription_name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), SubscriptionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deliver an event to the transport.

§Arguments
  • event - The subscription event to deliver
  • subscription_name - Name of the subscription
§Returns

Ok(()) on successful delivery, Err on failure.

Source

fn name(&self) -> &'static str

Get the adapter name for logging/metrics.

Source

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

Check if the adapter is healthy/connected.

Implementors§