feat: add pub/sub support to dispatcher
Some checks failed
default / dotnet-default-workflow (pull_request) Failing after 1m46s
Some checks failed
default / dotnet-default-workflow (pull_request) Failing after 1m46s
Notifications are broadcast to zero or more handlers with configurable publishing strategies (sequential or parallel) and pipeline behavior support.
This commit is contained in:
parent
eff887b49f
commit
ed8ac913b6
27 changed files with 814 additions and 7 deletions
20
src/request.dispatcher/INotificationPublisher.cs
Normal file
20
src/request.dispatcher/INotificationPublisher.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Request.Dispatcher;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a strategy for publishing notifications to registered handlers.
|
||||
/// </summary>
|
||||
public interface INotificationPublisher
|
||||
{
|
||||
/// <summary>
|
||||
/// Publishes the specified notification to the given collection of handlers.
|
||||
/// </summary>
|
||||
/// <typeparam name="TNotification">The type of notification being published. Must implement <see cref="INotification"/>.</typeparam>
|
||||
/// <param name="handlers">The list of handlers to invoke.</param>
|
||||
/// <param name="notification">The notification instance to publish.</param>
|
||||
/// <param name="cancellationToken">A token to monitor for cancellation requests.</param>
|
||||
/// <returns>A task representing the asynchronous publish operation.</returns>
|
||||
Task PublishAsync<TNotification>(IEnumerable<INotificationHandler<TNotification>> handlers, TNotification notification, CancellationToken cancellationToken) where TNotification : INotification;
|
||||
}
|
||||
Loading…
Reference in a new issue