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§
Sourcetype Subscription: Send
type Subscription: Send
One active transport subscription.
Required Methods§
Sourcefn 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 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.
Sourcefn 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,
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.