Skip to main content

CommandHandlerService

Trait CommandHandlerService 

Source
pub trait CommandHandlerService:
    Send
    + Sync
    + 'static {
    // Required methods
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ContextualCommand>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<BusinessResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn replay<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ReplayRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<ReplayResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with CommandHandlerServiceServer.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, request: Request<ContextualCommand>, ) -> Pin<Box<dyn Future<Output = Result<Response<BusinessResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process command and return business response (events or revocation request)

Source

fn replay<'life0, 'async_trait>( &'life0 self, request: Request<ReplayRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ReplayResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replay events to compute state (for conflict detection) Optional: only needed if aggregate supports MERGE_COMMUTATIVE

Implementors§

Source§

impl<S, H> CommandHandlerService for CommandHandlerGrpc<S, H>
where S: Default + Send + Sync + 'static, H: CommandHandlerDomainHandler<State = S> + Clone + 'static,