Skip to content

NotificationPublishStrategy enum

Namespace: Vitreous
Assembly: Vitreous.dll

Controls how INotificationHandler<TNotification> instances are invoked when a notification is published.

public enum NotificationPublishStrategy

Parallel = 1

All handlers are started concurrently via WhenAll. Every handler runs to completion regardless of individual failures; all exceptions are collected and re-thrown as an AggregateException (also when only one handler is registered). If handlers were only canceled, an OperationCanceledException is thrown instead.

Handlers that share mutable scoped services (e.g. a DbContext injected from the same DI scope) should be aware that those services will be accessed concurrently. Use IServiceScopeFactory inside such handlers to create an isolated child scope when needed.

Sequential = 0

Handlers are invoked one after another in registration order. The first failure stops the chain (fail-fast). This is the default.