Interface IMaterializedViewProcessor
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Defines the contract for processing events and updating materialized views.
public interface IMaterializedViewProcessor
Remarks
The processor is responsible for:
- Loading views from the store
- Applying events via registered builders
- Saving updated views to the store
- Tracking processing position
Methods
CatchUpAsync(string, CancellationToken)
Catches up a view from its last known position to the current position.
[RequiresUnreferencedCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
[RequiresDynamicCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
Task CatchUpAsync(string viewName, CancellationToken cancellationToken)
Parameters
viewNamestringThe view name to catch up.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the asynchronous operation.
ProcessEventAsync(IDomainEvent, long, CancellationToken)
Processes an event, updating all relevant materialized views.
[RequiresUnreferencedCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
[RequiresDynamicCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
Task ProcessEventAsync(IDomainEvent @event, long position, CancellationToken cancellationToken)
Parameters
eventIDomainEventThe event to process.
positionlongThe global position of the event for tracking.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the asynchronous operation.
ProcessEventsAsync(IEnumerable<(IDomainEvent Event, long Position)>, CancellationToken)
Processes a batch of events, updating all relevant materialized views.
[RequiresUnreferencedCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
[RequiresDynamicCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
Task ProcessEventsAsync(IEnumerable<(IDomainEvent Event, long Position)> events, CancellationToken cancellationToken)
Parameters
eventsIEnumerable<(IDomainEvent Event, long Position)>The events to process with their positions.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the asynchronous operation.
RebuildAsync(CancellationToken)
Rebuilds all materialized views from scratch.
[RequiresUnreferencedCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
[RequiresDynamicCode("The materialized view store serializes view types reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
Task RebuildAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the asynchronous operation.
Remarks
This operation clears existing view data and replays all events from the beginning. Use with caution in production as this can be a long-running operation.