pub trait MessageHandler:
Send
+ Sync
+ 'static {
// Required method
fn handle<'life0, 'async_trait>(
&'life0 self,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<ProcessingResult, MessagingError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn on_deserialize_error<'life0, 'life1, 'async_trait>(
&'life0 self,
_error: &'life1 MessagingError,
) -> Pin<Box<dyn Future<Output = ProcessingResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Trait for handling received messages
Required Methods§
Sourcefn handle<'life0, 'async_trait>(
&'life0 self,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<ProcessingResult, MessagingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<ProcessingResult, MessagingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a received message
Provided Methods§
Sourcefn on_deserialize_error<'life0, 'life1, 'async_trait>(
&'life0 self,
_error: &'life1 MessagingError,
) -> Pin<Box<dyn Future<Output = ProcessingResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_deserialize_error<'life0, 'life1, 'async_trait>(
&'life0 self,
_error: &'life1 MessagingError,
) -> Pin<Box<dyn Future<Output = ProcessingResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a message cannot be deserialized