Table of Contents

Interface IProjectionRecovery

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

Re-folds one aggregate's projection row from its event stream, on demand.

public interface IProjectionRecovery

Remarks

UseEventNotification registers this service, so a host that registers projections at all has it; call UseProjectionRecovery directly only to get recovery without the notification pipeline. It is not merely a convenience: erasing an aggregate re-folds the affected projection rows through this service, so a container without it fails that path.

A row that is simply behind needs nothing from this: the projection host applies committed events in global-stream order and does not advance past a batch whose apply faulted, so it retries that batch itself. Reach for recovery to repair one aggregate's row on demand instead of rebuilding the whole projection.

ReapplyAsync<TProjection>(string, string, CancellationToken) loads all events from the event store for the given aggregate and applies them through the registered When<T> handlers, then persists the result. It does NOT re-append events.

Methods

ReapplyAsync<TProjection>(string, string, CancellationToken)

Re-applies all events for the specified aggregate to the projection, replacing the current projection state. Does not re-append events to the event store.

Task ReapplyAsync<TProjection>(string aggregateId, string aggregateType, CancellationToken cancellationToken) where TProjection : class, new()

Parameters

aggregateId string

The aggregate identifier whose projection failed.

aggregateType string

The aggregate type name (required for event store stream lookup).

cancellationToken CancellationToken

Cancellation token.

Returns

Task

A task representing the asynchronous recovery operation.

Type Parameters

TProjection

The projection type to recover.

Exceptions

NotSupportedException

The projection uses TransactionalInline. Ordinary replay cannot preserve its event-transaction ownership.