pub trait MicroserviceHandler:
Send
+ Sync
+ 'static {
// Required methods
fn handle_message<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Option<Result<Value, TransportError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn handle_event<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A Nest-style microservice handler registry entrypoint (controller/service methods annotated with
#[message_pattern] / #[event_pattern] via the #[micro_routes] impl macro).
Required Methods§
Sourcefn handle_message<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Option<Result<Value, TransportError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_message<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = Option<Result<Value, TransportError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a request/reply message pattern. Return None when the handler doesn’t match pattern.
Sourcefn handle_event<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_event<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
payload: Value,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a fire-and-forget event pattern. Return true when the handler matched pattern.