Class PublishersExtension
- Namespace
- Arc4u.Dispatcher.Notification
- Assembly
- Arc4u.Dispatcher.dll
Extension methods to publish a notification to all the registered handlers, either concurrently or one after the other.
public static class PublishersExtension
- Inheritance
-
PublishersExtension
- Inherited Members
Methods
PublishForEachAsync<T>(INotificationHandlers<T>, T, CancellationToken)
Calls every registered INotificationHandler<T> sequentially, in registration order, waiting for each one before calling the next.
public static Task PublishForEachAsync<T>(this INotificationHandlers<T> notifier, T param, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T>The collection of handlers to call.
paramTThe notified object.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
TThe type of the notified object.
Exceptions
- Exception
An exception raised by a handler is propagated and the remaining handlers are not called.
PublishForEachAsync<T1, T2>(INotificationHandlers<T1, T2>, T1, T2, CancellationToken)
Calls every registered INotificationHandler<T1, T2> sequentially, in registration order, waiting for each one before calling the next.
public static Task PublishForEachAsync<T1, T2>(this INotificationHandlers<T1, T2> notifier, T1 param1, T2 param2, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
Exceptions
- Exception
An exception raised by a handler is propagated and the remaining handlers are not called.
PublishForEachAsync<T1, T2, T3>(INotificationHandlers<T1, T2, T3>, T1, T2, T3, CancellationToken)
Calls every registered INotificationHandler<T1, T2, T3> sequentially, in registration order, waiting for each one before calling the next.
public static Task PublishForEachAsync<T1, T2, T3>(this INotificationHandlers<T1, T2, T3> notifier, T1 param1, T2 param2, T3 param3, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2, T3>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
param3T3The notification value number 3.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
T3The type of the notification value number 3.
Exceptions
- Exception
An exception raised by a handler is propagated and the remaining handlers are not called.
PublishForEachAsync<T1, T2, T3, T4>(INotificationHandlers<T1, T2, T3, T4>, T1, T2, T3, T4, CancellationToken)
Calls every registered INotificationHandler<T1, T2, T3, T4> sequentially, in registration order, waiting for each one before calling the next.
public static Task PublishForEachAsync<T1, T2, T3, T4>(this INotificationHandlers<T1, T2, T3, T4> notifier, T1 param1, T2 param2, T3 param3, T4 param4, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2, T3, T4>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
param3T3The notification value number 3.
param4T4The notification value number 4.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
T3The type of the notification value number 3.
T4The type of the notification value number 4.
Exceptions
- Exception
An exception raised by a handler is propagated and the remaining handlers are not called.
PublishForEachAsync<T1, T2, T3, T4, T5>(INotificationHandlers<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5, CancellationToken)
Calls every registered INotificationHandler<T1, T2, T3, T4, T5> sequentially, in registration order, waiting for each one before calling the next.
public static Task PublishForEachAsync<T1, T2, T3, T4, T5>(this INotificationHandlers<T1, T2, T3, T4, T5> notifier, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2, T3, T4, T5>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
param3T3The notification value number 3.
param4T4The notification value number 4.
param5T5The notification value number 5.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
T3The type of the notification value number 3.
T4The type of the notification value number 4.
T5The type of the notification value number 5.
Exceptions
- Exception
An exception raised by a handler is propagated and the remaining handlers are not called.
PublishWhenAllAsync<T>(INotificationHandlers<T>, T, CancellationToken)
Call each INotificationHandler<T> concurrently: the handlers are started one after the other on the calling thread, then awaited together. A handler that throws before returning its task prevents the following handlers from starting.
public static Task PublishWhenAllAsync<T>(this INotificationHandlers<T> notifier, T param, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T>The collection of handlers to call.
paramTThe notified object.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
TThe type of the object notified
Exceptions
- Exception
The first exception raised by a handler is rethrown when the task is awaited.
PublishWhenAllAsync<T1, T2>(INotificationHandlers<T1, T2>, T1, T2, CancellationToken)
Calls every registered INotificationHandler<T1, T2> concurrently (all the handlers are started one after the other on the calling thread, then awaited together). A handler that throws before returning its task prevents the following handlers from starting.
public static Task PublishWhenAllAsync<T1, T2>(this INotificationHandlers<T1, T2> notifier, T1 param1, T2 param2, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
Exceptions
- Exception
The first exception raised by a handler is rethrown when the task is awaited.
PublishWhenAllAsync<T1, T2, T3>(INotificationHandlers<T1, T2, T3>, T1, T2, T3, CancellationToken)
Calls every registered INotificationHandler<T1, T2, T3> concurrently (all the handlers are started one after the other on the calling thread, then awaited together). A handler that throws before returning its task prevents the following handlers from starting.
public static Task PublishWhenAllAsync<T1, T2, T3>(this INotificationHandlers<T1, T2, T3> notifier, T1 param1, T2 param2, T3 param3, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2, T3>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
param3T3The notification value number 3.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
T3The type of the notification value number 3.
Exceptions
- Exception
The first exception raised by a handler is rethrown when the task is awaited.
PublishWhenAllAsync<T1, T2, T3, T4>(INotificationHandlers<T1, T2, T3, T4>, T1, T2, T3, T4, CancellationToken)
Calls every registered INotificationHandler<T1, T2, T3, T4> concurrently (all the handlers are started one after the other on the calling thread, then awaited together). A handler that throws before returning its task prevents the following handlers from starting.
public static Task PublishWhenAllAsync<T1, T2, T3, T4>(this INotificationHandlers<T1, T2, T3, T4> notifier, T1 param1, T2 param2, T3 param3, T4 param4, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2, T3, T4>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
param3T3The notification value number 3.
param4T4The notification value number 4.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
T3The type of the notification value number 3.
T4The type of the notification value number 4.
Exceptions
- Exception
The first exception raised by a handler is rethrown when the task is awaited.
PublishWhenAllAsync<T1, T2, T3, T4, T5>(INotificationHandlers<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5, CancellationToken)
Calls every registered INotificationHandler<T1, T2, T3, T4, T5> concurrently (all the handlers are started one after the other on the calling thread, then awaited together). A handler that throws before returning its task prevents the following handlers from starting.
public static Task PublishWhenAllAsync<T1, T2, T3, T4, T5>(this INotificationHandlers<T1, T2, T3, T4, T5> notifier, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, CancellationToken cancellationToken)
Parameters
notifierINotificationHandlers<T1, T2, T3, T4, T5>The collection of handlers to call.
param1T1The notification value number 1.
param2T2The notification value number 2.
param3T3The notification value number 3.
param4T4The notification value number 4.
param5T5The notification value number 5.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when all the handlers have completed.
Type Parameters
T1The type of the notification value number 1.
T2The type of the notification value number 2.
T3The type of the notification value number 3.
T4The type of the notification value number 4.
T5The type of the notification value number 5.
Exceptions
- Exception
The first exception raised by a handler is rethrown when the task is awaited.