MessageHandler

Trait MessageHandler 

Source
pub trait MessageHandler<T>:
    Send
    + Sync
    + 'static
where T: DeserializeOwned + Send + Sync,
{ // Required method fn handle<'life0, 'async_trait>( &'life0 self, message: T, context: MessageContext, ) -> Pin<Box<dyn Future<Output = MessageResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; }
Expand description

Message handler trait for processing consumed messages

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, message: T, context: MessageContext, ) -> Pin<Box<dyn Future<Output = MessageResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle a received message

Implementors§

Source§

impl<F, T> MessageHandler<T> for SimpleMessageHandler<F, T>
where F: Fn(T, MessageContext) -> MessageResult + Send + Sync + 'static, T: DeserializeOwned + Send + Sync + 'static,