Class ReactorWaitExtensions

Namespace
Cratis.Chronicle.Reactors
Assembly
Cratis.Chronicle.dll

Helper extensions providing wait methods for projections.

public static class ReactorWaitExtensions
Inheritance
ReactorWaitExtensions
Inherited Members

Remarks

These extensions are very useful for integration testing purposes.

Methods

WaitForHandlerById(IReactors, ReactorId, TimeSpan?)

Waits for a reactor handler with the specified identifier to become available.

public static Task<IReactorHandler> WaitForHandlerById(this IReactors reactors, ReactorId reactorId, TimeSpan? timeout = null)

Parameters

reactors IReactors

The reactor system to query.

reactorId ReactorId

The identifier of the reactor to wait for.

timeout TimeSpan?

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

Returns

Task<IReactorHandler>

The available IReactorHandler.

WaitForState(IReactorHandler, ObserverRunningState, TimeSpan?)

Wait for the reactor to reach a specific running state.

public static Task WaitForState(this IReactorHandler reactor, ObserverRunningState runningState, TimeSpan? timeout = null)

Parameters

reactor IReactorHandler

Reactor 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(IReactorHandler, ObserverRunningState, TimeSpan?)

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

public static Task<ReactorState> WaitForStateAndGetState(this IReactorHandler reactor, ObserverRunningState runningState, TimeSpan? timeout = null)

Parameters

reactor IReactorHandler

Reactor 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<ReactorState>

The ReactorState observed when the reactor reached the requested state.

WaitForState<TReactor>(IReactors, ObserverRunningState, TimeSpan?)

Wait for the reactor to reach a specific running state.

public static Task WaitForState<TReactor>(this IReactors reactors, ObserverRunningState runningState, TimeSpan? timeout = null) where TReactor : IReactor

Parameters

reactors IReactors

Reactor system to wait for the specific reactor 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

TReactor

Type of reactor to wait for.

WaitForThereToBeFailedPartitions(IReactorHandler, TimeSpan?)

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

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

Parameters

reactor IReactorHandler

Reactor to wait for.

timeout TimeSpan?

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

Returns

Task<IEnumerable<FailedPartition>>

Awaitable task.

WaitForThereToBeFailedPartitions<TReactor>(IReactors, TimeSpan?)

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

public static Task<IEnumerable<FailedPartition>> WaitForThereToBeFailedPartitions<TReactor>(this IReactors reactors, TimeSpan? timeout = null) where TReactor : IReactor

Parameters

reactors IReactors

Reactor system to wait for the specific reactor for.

timeout TimeSpan?

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

Returns

Task<IEnumerable<FailedPartition>>

Awaitable task.

Type Parameters

TReactor

Type of reactor to wait for.

WaitTillActive(IReactorHandler, TimeSpan?)

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

public static Task WaitTillActive(this IReactorHandler reactor, TimeSpan? timeout = null)

Parameters

reactor IReactorHandler

Reactor to wait for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

WaitTillActiveAndGetState(IReactorHandler, TimeSpan?)

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

public static Task<ReactorState> WaitTillActiveAndGetState(this IReactorHandler reactor, TimeSpan? timeout = null)

Parameters

reactor IReactorHandler

Reactor to wait for.

timeout TimeSpan?

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

Returns

Task<ReactorState>

The ReactorState observed when the reactor became active.

WaitTillActive<TReactor>(IReactors, TimeSpan?)

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

public static Task WaitTillActive<TReactor>(this IReactors reactors, TimeSpan? timeout = null) where TReactor : IReactor

Parameters

reactors IReactors

Reactor system to wait for the specific reactor for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

Type Parameters

TReactor

Type of reactor to wait for.

WaitTillReachesEventSequenceNumber(IReactorHandler, EventSequenceNumber, TimeSpan?)

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

public static Task WaitTillReachesEventSequenceNumber(this IReactorHandler reactor, EventSequenceNumber eventSequenceNumber, TimeSpan? timeout = null)

Parameters

reactor IReactorHandler

Reactor 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<TReactor>(IReactors, EventSequenceNumber, TimeSpan?)

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

public static Task WaitTillReachesEventSequenceNumber<TReactor>(this IReactors reactors, EventSequenceNumber eventSequenceNumber, TimeSpan? timeout = null) where TReactor : IReactor

Parameters

reactors IReactors

Reactor system to wait for the specific reactor 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

TReactor

Type of reactor to wait for.

WaitTillSubscribed(IReactorHandler, TimeSpan?)

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

public static Task WaitTillSubscribed(this IReactorHandler reactor, TimeSpan? timeout = null)

Parameters

reactor IReactorHandler

Reactor to wait for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

WaitTillSubscribed<TReactor>(IReactors, TimeSpan?)

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

public static Task WaitTillSubscribed<TReactor>(this IReactors reactors, TimeSpan? timeout = null) where TReactor : IReactor

Parameters

reactors IReactors

Reactor system to wait for the specific reactor for.

timeout TimeSpan?

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

Returns

Task

Awaitable task.

Type Parameters

TReactor

Type of reactor to wait for.