Skip to main content

EventSubscriptionSource

Trait EventSubscriptionSource 

Source
pub trait EventSubscriptionSource: Send + Sync {
    type Item: Send;
    type Subscription: Send;
    type Error: Display + Send + Sync;

    // Required methods
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Subscription, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn receive<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subscription: &'life1 mut Self::Subscription,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Item, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A transport-specific source that can open and receive from one subscription.

The shared supervisor owns retries and lifecycle observations. Implementations own only one connection attempt and one-item receive semantics.

Required Associated Types§

Source

type Item: Send

Item emitted by the transport.

Source

type Subscription: Send

One active transport subscription.

Source

type Error: Display + Send + Sync

Transport error returned by subscribe or receive.

Required Methods§

Source

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

Opens one subscription attempt.

Source

fn receive<'life0, 'life1, 'async_trait>( &'life0 self, subscription: &'life1 mut Self::Subscription, ) -> Pin<Box<dyn Future<Output = Result<Self::Item, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Receives one item from an active subscription.

Implementors§