Skip to main content

AsyncEventConsumer

Trait AsyncEventConsumer 

Source
pub trait AsyncEventConsumer {
    type Event: DomainEvent + Sync;
    type Error: Send;

    // Required method
    fn consume<'a>(
        &'a mut self,
        event: &'a Self::Event,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>;
}
Expand description

English:
Handles borrowed domain events through boxed, Send futures.

Each future borrows the consumer mutably and the event for 'a. No executor, retries, or deduplication are supplied. Implementations define side effects and panic conditions; dropping a pending future does not promise rollback of work already performed.

日本語:
ボックス化された Send Future を通じて借用イベントを処理します。

各 Future はコンシューマーを可変借用し、イベントを 'a の間借用します。 実行器、再試行、重複排除は提供しません。副作用とパニック条件は実装が定め、 待機中の Future の破棄は、実行済み処理のロールバックを保証しません。

Required Associated Types§

Source

type Event: DomainEvent + Sync

English:
Event that can be shared by reference across threads.

日本語:
スレッド間で参照を共有できるイベントです。

Source

type Error: Send

English:
Consumer failure that can be transferred across threads.

日本語:
スレッド間で受け渡せるコンシューマーの失敗です。

Required Methods§

Source

fn consume<'a>( &'a mut self, event: &'a Self::Event, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'a>>

English:
Returns a future resolving to completion or a handler error for event. Errors do not establish whether side effects occurred; retry policy belongs to the caller.

日本語:
event の処理完了またはハンドラーのエラーを返す Future を作ります。 エラーだけでは副作用の有無は判断できず、再試行方針は呼び出し側が定めます。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§