Class EventNotificationOptions
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Configuration options for the post-commit notification phase that runs at the end of
EventSourcedRepository.SaveAsync, and for the apply-latency threshold the projection
host warns at.
public sealed class EventNotificationOptions
- Inheritance
-
EventNotificationOptions
- Inherited Members
Properties
FailurePolicy
Gets or sets the failure policy for post-commit notification handlers.
public NotificationFailurePolicy FailurePolicy { get; set; }
Property Value
- NotificationFailurePolicy
The failure policy. Defaults to Propagate, which surfaces handler failures to the caller.
Remarks
When set to Propagate, a failing handler has its
own exception rethrown from SaveAsync. Since the events are already committed, the
caller must NOT retry SaveAsync: the save succeeded and only the handler did not.
When set to LogAndContinue, failures are logged at Error level and the remaining handlers still run. This is suitable when a handler failure must not surface as a failed save.
PostCommitTimeout
Gets or sets how long the broker waits for asynchronous post-commit notifications.
public TimeSpan PostCommitTimeout { get; set; }
Property Value
- TimeSpan
The bound. Defaults to 30 seconds. Must be between 1 second and 10 minutes.
Remarks
This phase does not honour the caller's cancellation token, deliberately. It runs after the events are durable, and at that point the caller's intent to cancel is no longer actionable: nothing can un-commit them. Honouring it would mean a shut-down host or an abandoned request leaves the read model unapplied while the caller is told its durable save failed. So the phase is bounded by its own clock instead, and this is that bound.
It is a BACKSTOP, not a budget. It exists so an unresponsive projection store cannot hold a save
open forever; it is not a latency target, and a handler that routinely approaches it is a defect
in the handler. Validated by EventNotificationOptionsValidator.
Expiry cancels the handler token and stops waiting. A handler that ignores cancellation may still complete; its scope stays alive until then and no subsequent callback starts. Expiry follows FailurePolicy and never rolls back committed events. Handlers must return a task promptly: synchronous blocking before returning that task cannot be interrupted by this bound.
ProjectionApplyWarningThreshold
Gets or sets the duration threshold after which a warning is logged for the time taken to apply one batch of events to one projection.
public TimeSpan ProjectionApplyWarningThreshold { get; set; }
Property Value
- TimeSpan
The warning threshold. Defaults to 100 milliseconds. Must be between 1 millisecond and 10 minutes.
Remarks
The projection host applies committed events in global-stream order. A slow apply is the reason a session-consistent read waits, and the reason it can report that its bound expired, so this threshold is the earliest signal that reads are about to degrade.
This is the fallback for projections that set no threshold of their own. A per-projection
WithOptions(o => o.WarningThreshold = ...) takes precedence over it.
Validated by EventNotificationOptionsValidator.