Table of Contents

Interface IProjections

Namespace
Cratis.Chronicle.Projections
Assembly
Cratis.Chronicle.dll

Defines a system that works with projections in the system.

public interface IProjections
Extension Methods

Methods

Discover()

Discover all projections from entry assembly and dependencies.

Task Discover()

Returns

Task

Awaitable task.

GetAllHandlers()

Get all registered handlers.

IEnumerable<IProjectionHandler> GetAllHandlers()

Returns

IEnumerable<IProjectionHandler>

Collection of IProjectionHandler.

GetExternalEventStoreSubscriptions()

Get the external event store subscription requirements derived from all discovered projection definitions.

IEnumerable<(string EventStoreName, IEnumerable<EventTypeId> EventTypeIds)> GetExternalEventStoreSubscriptions()

Returns

IEnumerable<(string EventStoreName, IEnumerable<EventTypeId> EventTypeIds)>

A collection of tuples mapping external event store names to their event type identifiers.

Remarks

Returns one entry per external event store name, collecting all event type identifiers used by projections whose event sequence is an inbox sequence for that store.

GetFailedPartitionsFor(Type)

Get any failed partitions for a specific projection.

Task<IEnumerable<FailedPartition>> GetFailedPartitionsFor(Type projectionType)

Parameters

projectionType Type

Type of projection.

Returns

Task<IEnumerable<FailedPartition>>

Collection of FailedPartition, if any.

GetFailedPartitionsFor<TProjection>()

Get any failed partitions for a specific projection.

Task<IEnumerable<FailedPartition>> GetFailedPartitionsFor<TProjection>() where TProjection : IProjection

Returns

Task<IEnumerable<FailedPartition>>

Collection of FailedPartition, if any.

Type Parameters

TProjection

Type of projection.

GetHandlerFor<TProjection>()

Get the IProjectionHandler for a specific projection type.

IProjectionHandler GetHandlerFor<TProjection>() where TProjection : IProjection

Returns

IProjectionHandler

IProjectionHandler for the projection.

Type Parameters

TProjection

Type of projection to get for.

GetProjectionIdForModel(Type)

Get the ProjectionId for a specific type.

ProjectionId GetProjectionIdForModel(Type readModelType)

Parameters

readModelType Type

Type of read model to get for.

Returns

ProjectionId

The ProjectionId for the type.

GetProjectionIdForModel<TReadModel>()

Get the ProjectionId for a specific type.

ProjectionId GetProjectionIdForModel<TReadModel>()

Returns

ProjectionId

The ProjectionId for the type.

Type Parameters

TReadModel

Type of read model to get for.

GetProjectionIdFor<TProjection>()

Get the ProjectionId for a specific type.

ProjectionId GetProjectionIdFor<TProjection>() where TProjection : IProjection

Returns

ProjectionId

The ProjectionId for the type.

Type Parameters

TProjection

Type of projection to get for.

GetStateFor<TProjection>()

Get the state of a specific projection.

Task<ProjectionState> GetStateFor<TProjection>() where TProjection : IProjection

Returns

Task<ProjectionState>

ProjectionState.

Type Parameters

TProjection

Type of projection get for.

HasFor(ProjectionId)

Check if there is a definition for a specific projection identifier.

bool HasFor(ProjectionId projectionId)

Parameters

projectionId ProjectionId

Identifier of projection.

Returns

bool

True if it exists, false if not.

HasFor(Type)

Check if there is a definition for a specific type.

bool HasFor(Type readModelType)

Parameters

readModelType Type

Type of read model to check for.

Returns

bool

True if it exists, false if not.

HasFor<TReadModel>()

Check if there is a definition for a specific type.

bool HasFor<TReadModel>()

Returns

bool

True if it exists, false if not.

Type Parameters

TReadModel

Type of read model to check for.

Query(string, string)

Query a projection declaration against the event log without registering it.

Task<ProjectionQueryResult> Query(string declaration, string eventSequenceId = "event-log")

Parameters

declaration string

The Projection Declaration Language string to query.

eventSequenceId string

Optional event sequence identifier to query. Defaults to "event-log".

Returns

Task<ProjectionQueryResult>

A ProjectionQueryResult containing the resulting read model entries.

Remarks

The declaration may omit the => ReadModelType target — in that case the read model schema is inferred from the events used in the projection. An inferred read model can never be registered as a permanent projection; query-only declarations are exclusively for ad-hoc exploration.

Exceptions

UnableToQueryProjection

Thrown when the declaration contains errors.

Register()

Register all projections with Chronicle.

Task Register()

Returns

Task

Awaitable task.

Replay(ProjectionId)

Replay a specific projection by its identifier.

Task Replay(ProjectionId projectionId)

Parameters

projectionId ProjectionId

ProjectionId to replay.

Returns

Task

Awaitable task.

Replay<TProjection>()

Replay a specific projection.

Task Replay<TProjection>() where TProjection : IProjection

Returns

Task

Awaitable task.

Type Parameters

TProjection

Type of projection to replay.