-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIDomainEventPublisher.cs
More file actions
24 lines (21 loc) · 1.08 KB
/
Copy pathIDomainEventPublisher.cs
File metadata and controls
24 lines (21 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Vulthil.SharedKernel.Events;
namespace Vulthil.SharedKernel.Application.Messaging.DomainEvents;
/// <summary>
/// Publishes domain events to their registered handlers.
/// </summary>
public interface IDomainEventPublisher
{
/// <summary>
/// Publishes a domain event by its runtime type to all registered handlers.
/// </summary>
/// <param name="notification">The domain event to publish.</param>
/// <param name="cancellationToken">A token to observe for cancellation.</param>
Task PublishAsync(object notification, CancellationToken cancellationToken = default);
/// <summary>
/// Publishes a strongly-typed domain event to all registered handlers.
/// </summary>
/// <typeparam name="TNotification">The type of domain event to publish.</typeparam>
/// <param name="notification">The domain event to publish.</param>
/// <param name="cancellationToken">A token to observe for cancellation.</param>
Task PublishAsync<TNotification>(TNotification notification, CancellationToken cancellationToken = default) where TNotification : IDomainEvent;
}