Class EventNotificationContext
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Provides context about the aggregate whose events are being notified, passed to NotifyAsync(IReadOnlyList<IDomainEvent>, EventNotificationContext) and HandleAsync(TEvent, EventNotificationContext, CancellationToken).
public sealed record EventNotificationContext : IEquatable<EventNotificationContext>
- Inheritance
-
EventNotificationContext
- Implements
- Inherited Members
Remarks
On IsReplay. Stated here rather than on the parameter because a member carries one
remarks block: two of them meant the generator kept one and dropped the other, and the one
it dropped was this correction.
- A catch-up read is NOT a replay. Events committed before a subscription started are ones it has never applied, so no effect has been performed for them; classifying them as re-deliveries told handlers to skip effects that never happened.
- The live subscription DOES hard-code it, to false, and that is the only sound value: it reads strictly above its own checkpoint, so nothing it delivers can be something its own durable mark says it already applied. The re-fold paths hard-code true for the same reason — replay is a property of the operation, not a position to compare.
- It is NOT a duplicate-suppression mechanism. It is false on a redelivery after a crash or a reader overlap, because such a delivery is not a re-fold of history. A handler with effects outside the projection state must be idempotent on the event identifier; no flag the framework computes can substitute for that.
On GlobalPosition.
Constructors
EventNotificationContext(string, string, long, DateTimeOffset, bool, long?)
Provides context about the aggregate whose events are being notified, passed to NotifyAsync(IReadOnlyList<IDomainEvent>, EventNotificationContext) and HandleAsync(TEvent, EventNotificationContext, CancellationToken).
public EventNotificationContext(string AggregateId, string AggregateType, long CommittedVersion, DateTimeOffset Timestamp, bool IsReplay = false, long? GlobalPosition = null)
Parameters
AggregateIdstringThe unique identifier of the aggregate that produced the events.
AggregateTypestringThe type name of the aggregate.
CommittedVersionlongThe aggregate version after the events were committed.
TimestampDateTimeOffsetThe UTC timestamp when the notification was created.
IsReplaybooltrue when the delivery is part of a DELIBERATE re-fold of stored history — a rebuild, a recovery, or an on-demand build. It is a property of the operation, set by whatever asked for the re-fold.
GlobalPositionlong?The global-stream position of the last event in this notification, or null when the events do not come from a global-stream read.
Remarks
On IsReplay. Stated here rather than on the parameter because a member carries one
remarks block: two of them meant the generator kept one and dropped the other, and the one
it dropped was this correction.
- A catch-up read is NOT a replay. Events committed before a subscription started are ones it has never applied, so no effect has been performed for them; classifying them as re-deliveries told handlers to skip effects that never happened.
- The live subscription DOES hard-code it, to false, and that is the only sound value: it reads strictly above its own checkpoint, so nothing it delivers can be something its own durable mark says it already applied. The re-fold paths hard-code true for the same reason — replay is a property of the operation, not a position to compare.
- It is NOT a duplicate-suppression mechanism. It is false on a redelivery after a crash or a reader overlap, because such a delivery is not a re-fold of history. A handler with effects outside the projection state must be idempotent on the event identifier; no flag the framework computes can substitute for that.
On GlobalPosition.
Properties
AggregateId
The unique identifier of the aggregate that produced the events.
public string AggregateId { get; init; }
Property Value
AggregateType
The type name of the aggregate.
public string AggregateType { get; init; }
Property Value
CommittedVersion
The aggregate version after the events were committed.
public long CommittedVersion { get; init; }
Property Value
GlobalPosition
The global-stream position of the last event in this notification, or null when the events do not come from a global-stream read.
public long? GlobalPosition { get; init; }
Property Value
- long?
IsReplay
true when the delivery is part of a DELIBERATE re-fold of stored history — a rebuild, a recovery, or an on-demand build. It is a property of the operation, set by whatever asked for the re-fold.
public bool IsReplay { get; init; }
Property Value
Timestamp
The UTC timestamp when the notification was created.
public DateTimeOffset Timestamp { get; init; }