Trait RequestHandler

Source
pub trait RequestHandler: Send + Sync {
    // Required method
    fn handle_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        resource_id: u16,
        message_attributes: &'life1 UAttributes,
        request_payload: Option<UPayload>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A handler for processing incoming RPC requests.

Required Methods§

Source

fn handle_request<'life0, 'life1, 'async_trait>( &'life0 self, resource_id: u16, message_attributes: &'life1 UAttributes, request_payload: Option<UPayload>, ) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handles a request to invoke a method with given input parameters.

Implementations MUST NOT block the calling thread. Long running computations should be performed on a separate worker thread, yielding on the calling thread.

§Arguments
  • resource_id - The resource identifier of the method to invoke.
  • message_attributes - Any metadata that is associated with the request message.
  • request_payload - The raw payload that contains the input data for the method.
§Returns

the output data generated by the method.

§Errors

Returns an error if the request could not be processed successfully.

Implementors§

Source§

impl RequestHandler for MockRequestHandler

A handler for processing incoming RPC requests.