Skip to content

Not Rewindable

Mark a projection as not rewindable (forward-only) using [NotRewindable]:

using Cratis.Chronicle.Events;
using Cratis.Chronicle.Keys;
using Cratis.Chronicle.Projections.ModelBound;
[EventType]
public record MbNotRewindableAuditEvent(string Message, DateTimeOffset OccurredAt);
[NotRewindable]
public record MbNotRewindableAuditLog(
[Key]
Guid Id,
[SetFrom<MbNotRewindableAuditEvent>(nameof(MbNotRewindableAuditEvent.Message))]
string Message,
[SetFrom<MbNotRewindableAuditEvent>(nameof(MbNotRewindableAuditEvent.OccurredAt))]
DateTimeOffset Timestamp);
  • Audit logs or append-only data
  • Projections that should never be replayed from scratch
  • Time-sensitive data where replay would be incorrect
  • Use for append-only scenarios where historical replay would be problematic
  • Consider carefully as this removes the ability to rebuild the projection from scratch
  • Ensure you have alternative recovery strategies if the projection becomes corrupted