Table of Contents

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

viewName string

The view name to catch up.

cancellationToken CancellationToken

Cancellation 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

event IDomainEvent

The event to process.

position long

The global position of the event for tracking.

cancellationToken CancellationToken

Cancellation 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

events IEnumerable<(IDomainEvent Event, long Position)>

The events to process with their positions.

cancellationToken CancellationToken

Cancellation 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

cancellationToken CancellationToken

Cancellation 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.