dotnet-cqrs/Svrnty.CQRS.Events.Abstractions/Notifications/IEventNotifier.cs

22 lines
873 B
C#

using System.Threading;
using Svrnty.CQRS.Events.Abstractions.EventStore;
using System.Threading.Tasks;
namespace Svrnty.CQRS.Events.Abstractions.Notifications;
/// <summary>
/// Service for notifying active subscribers about new events in real-time.
/// Implementations handle the transport layer (gRPC, SignalR, etc.).
/// </summary>
public interface IEventNotifier
{
/// <summary>
/// Notify all active subscribers about a new event.
/// This is called after an event is stored to push it to connected clients.
/// </summary>
/// <param name="event">The event that was emitted.</param>
/// <param name="sequence">The sequence number assigned to this event.</param>
/// <param name="cancellationToken">Cancellation token.</param>
Task NotifyAsync(ICorrelatedEvent @event, long sequence, CancellationToken cancellationToken = default);
}