Table of Contents

Class ForeachAwaitContinueOnFailurePublisher

Namespace
Caesar.NotificationPublishers
Assembly
Caesar.dll

Awaits handlers one after another like ForeachAwaitPublisher, but keeps going after a failing handler and throws an AggregateException at the end if any handler failed. Useful when every subscriber must get the event even if one of them is broken.

public sealed class ForeachAwaitContinueOnFailurePublisher : INotificationPublisher
Inheritance
ForeachAwaitContinueOnFailurePublisher
Implements
Inherited Members

Remarks

A single failure is rethrown as-is, with its original stack trace. Once cancellationToken is cancelled no further handler is invoked: the publish is canceled if nothing failed so far, otherwise the failures collected until then are thrown and the cancellation is dropped, as WhenAll(params Task[]) lets faults win over cancellation.

Constructors

ForeachAwaitContinueOnFailurePublisher()

public ForeachAwaitContinueOnFailurePublisher()

Methods

Publish(IEnumerable<NotificationHandlerExecutor>, INotification, CancellationToken)

Invokes the handler executors for notification.

public Task Publish(IEnumerable<NotificationHandlerExecutor> handlerExecutors, INotification notification, CancellationToken cancellationToken)

Parameters

handlerExecutors IEnumerable<NotificationHandlerExecutor>

One executor per resolved handler: those for the notification's runtime type, in registration order, then those registered for its base classes and interfaces.

notification INotification

The notification being published.

cancellationToken CancellationToken

Cancellation token.

Returns

Task