Table of Contents

Class ProjectionWaitExtensions

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

Helper extensions providing wait methods for projections.

public static class ProjectionWaitExtensions
Inheritance
ProjectionWaitExtensions
Inherited Members

Remarks

These extensions are very useful for integration testing purposes.

Methods

WaitForState(IProjectionHandler, ObserverRunningState, TimeSpan?)

Wait for the projection to reach a specific running state.

public static Task WaitForState(this IProjectionHandler projection, ObserverRunningState runningState, TimeSpan? timeout = null)

Parameters

projection IProjectionHandler

Projection to wait for.

runningState ObserverRunningState

The expected ObserverRunningState to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

WaitForState<TProjection>(IProjections, ObserverRunningState, TimeSpan?)

Wait for the projection to reach a specific running state.

public static Task WaitForState<TProjection>(this IProjections projections, ObserverRunningState runningState, TimeSpan? timeout = null) where TProjection : IProjection

Parameters

projections IProjections

Projection system to wait for the specific projection for.

runningState ObserverRunningState

The expected ObserverRunningState to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

Type Parameters

TProjection

Type of projection to wait for.

WaitForThereToBeFailedPartitions(IProjectionHandler, TimeSpan?)

Wait for there to be failed partitions for a specific projection, with an optional timeout.

public static Task<IEnumerable<FailedPartition>> WaitForThereToBeFailedPartitions(this IProjectionHandler projection, TimeSpan? timeout = null)

Parameters

projection IProjectionHandler

Projection to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task<IEnumerable<FailedPartition>>

Awaitable task.

WaitForThereToBeFailedPartitions<TProjection>(IProjections, TimeSpan?)

Wait for there to be failed partitions for a specific projection, with an optional timeout.

public static Task<IEnumerable<FailedPartition>> WaitForThereToBeFailedPartitions<TProjection>(this IProjections projections, TimeSpan? timeout = null) where TProjection : IProjection

Parameters

projections IProjections

Projection system to wait for the specific projection for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task<IEnumerable<FailedPartition>>

Awaitable task.

Type Parameters

TProjection

Type of reactor to wait for.

WaitTillActive(IProjectionHandler, TimeSpan?)

Wait till the projection is active, with an optional timeout.

public static Task WaitTillActive(this IProjectionHandler projection, TimeSpan? timeout = null)

Parameters

projection IProjectionHandler

Projection to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

WaitTillActive<TProjection>(IProjections, TimeSpan?)

Wait till the projection is active, with an optional timeout.

public static Task WaitTillActive<TProjection>(this IProjections projections, TimeSpan? timeout = null) where TProjection : IProjection

Parameters

projections IProjections

Projection system to wait for the specific projection for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

Type Parameters

TProjection

Type of reactor to wait for.

WaitTillReachesEventSequenceNumber(IProjectionHandler, EventSequenceNumber, TimeSpan?)

Wait till the projection reaches a specific event sequence number, with an optional timeout.

public static Task WaitTillReachesEventSequenceNumber(this IProjectionHandler projection, EventSequenceNumber eventSequenceNumber, TimeSpan? timeout = null)

Parameters

projection IProjectionHandler

Projection to wait for.

eventSequenceNumber EventSequenceNumber

The expected EventSequenceNumber to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

WaitTillReachesEventSequenceNumber<TProjection>(IProjections, EventSequenceNumber, TimeSpan?)

Wait till the projection reaches a specific event sequence number, with an optional timeout.

public static Task WaitTillReachesEventSequenceNumber<TProjection>(this IProjections projections, EventSequenceNumber eventSequenceNumber, TimeSpan? timeout = null) where TProjection : IProjection

Parameters

projections IProjections

Projection system to wait for the specific projection for.

eventSequenceNumber EventSequenceNumber

The expected EventSequenceNumber to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

Type Parameters

TProjection

Type of reactor to wait for.

WaitTillSubscribed(IProjectionHandler, TimeSpan?)

Wait till the reactor has been subscribed, with an optional timeout.

public static Task WaitTillSubscribed(this IProjectionHandler projection, TimeSpan? timeout = null)

Parameters

projection IProjectionHandler

Projection to wait for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

WaitTillSubscribed<TProjection>(IProjections, TimeSpan?)

Wait till the reactor has been subscribed, with an optional timeout.

public static Task WaitTillSubscribed<TProjection>(this IProjections projections, TimeSpan? timeout = null) where TProjection : IProjection

Parameters

projections IProjections

Projection system to wait for the specific projection for.

timeout TimeSpan?

Optional timeout. If none is provided, it will default to 5 seconds.

Returns

Task

Awaitable task.

Type Parameters

TProjection

Type of reactor to wait for.