Skip to main content

Subscriber

Trait Subscriber 

Source
pub trait Subscriber {
    // Required method
    fn subscribe<E: Event + 'static>(
        &self,
    ) -> impl Future<Output = Result<impl Stream<Item = Result<impl ReceivedEvent<E> + Send + Sync + 'static, Error>> + Send + 'static, Error>> + Send;
}
Expand description

Subscribes to events from the message bus.

Multiple service instances with the same consumer name will automatically load-balance message processing.

Required Methods§

Source

fn subscribe<E: Event + 'static>( &self, ) -> impl Future<Output = Result<impl Stream<Item = Result<impl ReceivedEvent<E> + Send + Sync + 'static, Error>> + Send + 'static, Error>> + Send

Subscribe to events of type E.

Returns a stream that yields acknowledged-capable event wrappers.

§Errors

Returns Error::SubscriptionFailed if the subscription could not be created.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§