Interface IEventNotificationHandler<TEvent>
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Handles a domain event notification raised during EventSourcedRepository.SaveAsync.
public interface IEventNotificationHandler<in TEvent> where TEvent : IDomainEvent
Type Parameters
TEventThe domain event type. Contravariant to allow a handler for a base event type to handle derived event types.
Remarks
This handler is distinct from IEventHandler<T> in the Dispatch layer.
Dispatch handlers are transport-aware and participate in the messaging pipeline.
This handler is EventSourcing-level, in-process only, and invoked during SaveAsync
once the events are durable.
Notification handlers run sequentially, one event at a time in commit order. They are resolved from DI and invoked in registration order.
Methods
HandleAsync(TEvent, EventNotificationContext, CancellationToken)
Handles the domain event notification.
Task HandleAsync(TEvent @event, EventNotificationContext context, CancellationToken cancellationToken)
Parameters
eventTEventThe domain event that was committed.
contextEventNotificationContextContext about the aggregate that produced the event.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the asynchronous operation.