Table of Contents

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

notifier INotificationHandlers<T>

The collection of handlers to call.

param T

The notified object.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T

The 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

notifier INotificationHandlers<T1, T2>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The 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

notifier INotificationHandlers<T1, T2, T3>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

param3 T3

The notification value number 3.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The type of the notification value number 2.

T3

The 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

notifier INotificationHandlers<T1, T2, T3, T4>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

param3 T3

The notification value number 3.

param4 T4

The notification value number 4.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The type of the notification value number 2.

T3

The type of the notification value number 3.

T4

The 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

notifier INotificationHandlers<T1, T2, T3, T4, T5>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

param3 T3

The notification value number 3.

param4 T4

The notification value number 4.

param5 T5

The notification value number 5.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The type of the notification value number 2.

T3

The type of the notification value number 3.

T4

The type of the notification value number 4.

T5

The 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

notifier INotificationHandlers<T>

The collection of handlers to call.

param T

The notified object.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T

The 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

notifier INotificationHandlers<T1, T2>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The 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

notifier INotificationHandlers<T1, T2, T3>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

param3 T3

The notification value number 3.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The type of the notification value number 2.

T3

The 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

notifier INotificationHandlers<T1, T2, T3, T4>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

param3 T3

The notification value number 3.

param4 T4

The notification value number 4.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The type of the notification value number 2.

T3

The type of the notification value number 3.

T4

The 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

notifier INotificationHandlers<T1, T2, T3, T4, T5>

The collection of handlers to call.

param1 T1

The notification value number 1.

param2 T2

The notification value number 2.

param3 T3

The notification value number 3.

param4 T4

The notification value number 4.

param5 T5

The notification value number 5.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when all the handlers have completed.

Type Parameters

T1

The type of the notification value number 1.

T2

The type of the notification value number 2.

T3

The type of the notification value number 3.

T4

The type of the notification value number 4.

T5

The type of the notification value number 5.

Exceptions

Exception

The first exception raised by a handler is rethrown when the task is awaited.