Skip to main content

CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler {
    type Command;
    type Aggregate: AggregateRoot;
    type Repository: Repository<Aggregate = Self::Aggregate>;
    type Publisher: DomainEventPublisher<Event = <Self::Aggregate as AggregateRoot>::Event>;
    type Output;
    type Error;

    // Required method
    fn handle<F>(
        &mut self,
        id: &<Self::Aggregate as Entity>::Id,
        command: Self::Command,
        callback: F,
    ) -> Result<Self::Output, Self::Error>
       where F: for<'a> LifecycleCallback<'a, Self::Aggregate, Self::Repository, Self::Publisher, Output = Self::Output, Error = Self::Error>,
             Self::Error: From<LifecycleOperationError<<Self::Repository as Repository>::Error>> + From<LifecycleOperationError<<Self::Publisher as DomainEventPublisher>::Error>> + From<LifecycleCompletionError>;
}
Expand description

English:
Loads an aggregate for a command, runs its lifecycle callback, and returns the callback output or an error.

日本語:
コマンド対象の集約を読み込み、ライフサイクルコールバックを実行し、その出力またはエラーを返します。

Required Associated Types§

Required Methods§

Source

fn handle<F>( &mut self, id: &<Self::Aggregate as Entity>::Id, command: Self::Command, callback: F, ) -> Result<Self::Output, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§