Skip to main content

CommandService

Trait CommandService 

Source
pub trait CommandService:
    Send
    + Sync
    + 'static {
    // Required methods
    fn submit<'life0, 'async_trait>(
        &'life0 self,
        request: Request<SubmitRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<CommandResult>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cancel<'life0, 'async_trait>(
        &'life0 self,
        request: Request<CancelRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<CancelResult>, 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 CommandServiceServer.

Required Methods§

Source

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

Submits a command and waits as wait says. Needs submit for the qualified command type, and a worker that registered it (or a membership that lists its aggregate), otherwise NOT_FOUND. Middlewares before the command may reject it; the outcome is then rejected. A command ID that was submitted before is not run again: Submit returns its stored result, or waits for it. If the command does not complete within the kernel’s submit timeout, Submit fails with DEADLINE_EXCEEDED, but the command stays queued: resubmit it to get the result. Other errors: UNAUTHENTICATED (missing or invalid signature), PERMISSION_DENIED, INVALID_ARGUMENT, FAILED_PRECONDITION (see listener; vault values without a vault), UNAVAILABLE (a middleware is not connected, or the kernel shuts down), DEADLINE_EXCEEDED (a middleware did not answer in time).

Source

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

Cancels a scheduled command (Command.deliver_at) before it is due: the command completes as rejected cancelled, so its ID answers that from then on. Needs submit for the command’s type; middlewares check it as a cancel of that type (MiddlewareCall.cancel), and may reject it. A command that is due already, running or completed answers too_late; an unknown ID not_found.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§