Class ReducerWaitExtensions

Namespace
Cratis.Chronicle.Reducers
Assembly
Cratis.Chronicle.dll

Helper extensions providing wait methods for reducers.

public static class ReducerWaitExtensions
Inheritance
ReducerWaitExtensions
Inherited Members

Remarks

These extensions are very useful for integration testing purposes.

Methods

WaitForState(IReducerHandler, ObserverRunningState, TimeSpan?)

Wait for the reducer to reach a specific running state.

public static Task WaitForState(this IReducerHandler reducer, ObserverRunningState runningState, TimeSpan? timeout = null)

Parameters

reducer IReducerHandler

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

WaitForStateAndGetState(IReducerHandler, ObserverRunningState, TimeSpan?)

Waits for the reducer to reach a specific running state and returns that state snapshot.

public static Task<ReducerState> WaitForStateAndGetState(this IReducerHandler reducer, ObserverRunningState runningState, TimeSpan? timeout = null)

Parameters

reducer IReducerHandler

Reducer 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<ReducerState>

The ReducerState observed when the reducer reached the requested state.

WaitForState<TReducer>(IReducers, ObserverRunningState, TimeSpan?)

Wait for the reducer to reach a specific running state.

public static Task WaitForState<TReducer>(this IReducers reducers, ObserverRunningState runningState, TimeSpan? timeout = null) where TReducer : IReducer

Parameters

reducers IReducers

Reducer system to wait for the specific reducer 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

TReducer

Type of reducer to wait for.

WaitForThereToBeFailedPartitions(IReducerHandler, TimeSpan?)

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

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

Parameters

reducer IReducerHandler

Reducer to wait for.

timeout TimeSpan?

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

Returns

Task<IEnumerable<FailedPartition>>

Awaitable task.

WaitForThereToBeFailedPartitions<TReducer>(IReducers, TimeSpan?)

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

public static Task<IEnumerable<FailedPartition>> WaitForThereToBeFailedPartitions<TReducer>(this IReducers reducers, TimeSpan? timeout = null) where TReducer : IReducer

Parameters

reducers IReducers

Reducer system to wait for the specific reducer for.

timeout TimeSpan?

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

Returns

Task<IEnumerable<FailedPartition>>

Awaitable task.

Type Parameters

TReducer

Type of reactor to wait for.

WaitTillActive(IReducerHandler, TimeSpan?)

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

public static Task WaitTillActive(this IReducerHandler reducer, TimeSpan? timeout = null)

Parameters

reducer IReducerHandler

Reducer to wait for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

WaitTillActiveAndGetState(IReducerHandler, TimeSpan?)

Waits until the reducer is active and returns that state snapshot.

public static Task<ReducerState> WaitTillActiveAndGetState(this IReducerHandler reducer, TimeSpan? timeout = null)

Parameters

reducer IReducerHandler

Reducer to wait for.

timeout TimeSpan?

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

Returns

Task<ReducerState>

The ReducerState observed when the reducer became active.

WaitTillActive<TReducer>(IReducers, TimeSpan?)

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

public static Task WaitTillActive<TReducer>(this IReducers reducers, TimeSpan? timeout = null) where TReducer : IReducer

Parameters

reducers IReducers

Reducer system to wait for the specific reducer for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

Type Parameters

TReducer

Type of reactor to wait for.

WaitTillReachesEventSequenceNumber(IReducerHandler, EventSequenceNumber, TimeSpan?)

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

public static Task WaitTillReachesEventSequenceNumber(this IReducerHandler reducer, EventSequenceNumber eventSequenceNumber, TimeSpan? timeout = null)

Parameters

reducer IReducerHandler

Reducer 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<TReducer>(IReducers, EventSequenceNumber, TimeSpan?)

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

public static Task WaitTillReachesEventSequenceNumber<TReducer>(this IReducers reducers, EventSequenceNumber eventSequenceNumber, TimeSpan? timeout = null) where TReducer : IReducer

Parameters

reducers IReducers

Reducer system to wait for the specific reducer 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

TReducer

Type of reactor to wait for.

WaitTillSubscribed(IReducerHandler, TimeSpan?)

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

public static Task WaitTillSubscribed(this IReducerHandler reducer, TimeSpan? timeout = null)

Parameters

reducer IReducerHandler

Reducer to wait for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

WaitTillSubscribed<TReducer>(IReducers, TimeSpan?)

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

public static Task WaitTillSubscribed<TReducer>(this IReducers reducers, TimeSpan? timeout = null) where TReducer : IReducer

Parameters

reducers IReducers

Reducer system to wait for the specific reducer for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

Type Parameters

TReducer

Type of reactor to wait for.