Table of Contents

Class EventStreamExtensions

Namespace
LfrlAnvil.Reactive.Chrono.Extensions
Assembly
LfrlAnvil.Reactive.Chrono.dll

Contains IEventStream<TEvent> extension methods.

public static class EventStreamExtensions
Inheritance
EventStreamExtensions
Inherited Members

Methods

Delay<TEvent>(IEventStream<TEvent>, ITimestampProvider, Duration)

Decorates the event stream with EventListenerDelayDecorator<TEvent>.

[Pure]
public static IEventStream<WithInterval<TEvent>> Delay<TEvent>(this IEventStream<TEvent> source, ITimestampProvider timestampProvider, Duration delay)

Parameters

source IEventStream<TEvent>

Source event stream.

timestampProvider ITimestampProvider

Timestamp provider to use for time tracking.

delay Duration

Event delay.

Returns

IEventStream<WithInterval<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.

Exceptions

ArgumentOutOfRangeException

When delay is less than 1 tick or greater than MaxValue milliseconds.

Delay<TEvent>(IEventStream<TEvent>, ITimestampProvider, Duration, Duration)

Decorates the event stream with EventListenerDelayDecorator<TEvent>.

[Pure]
public static IEventStream<WithInterval<TEvent>> Delay<TEvent>(this IEventStream<TEvent> source, ITimestampProvider timestampProvider, Duration delay, Duration spinWaitDurationHint)

Parameters

source IEventStream<TEvent>

Source event stream.

timestampProvider ITimestampProvider

Timestamp provider to use for time tracking.

delay Duration

Event delay.

spinWaitDurationHint Duration

SpinWait duration hint for the underlying timer.

Returns

IEventStream<WithInterval<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.

Exceptions

ArgumentOutOfRangeException

When delay is less than 1 tick or greater than MaxValue milliseconds or when spinWaitDurationHint is less than 0.

Delay<TEvent>(IEventStream<TEvent>, ITimestampProvider, Duration, TaskScheduler)

Decorates the event stream with EventListenerDelayDecorator<TEvent>.

[Pure]
public static IEventStream<WithInterval<TEvent>> Delay<TEvent>(this IEventStream<TEvent> source, ITimestampProvider timestampProvider, Duration delay, TaskScheduler scheduler)

Parameters

source IEventStream<TEvent>

Source event stream.

timestampProvider ITimestampProvider

Timestamp provider to use for time tracking.

delay Duration

Event delay.

scheduler TaskScheduler

Task scheduler.

Returns

IEventStream<WithInterval<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.

Exceptions

ArgumentOutOfRangeException

When delay is less than 1 tick or greater than MaxValue milliseconds.

Delay<TEvent>(IEventStream<TEvent>, ITimestampProvider, Duration, TaskScheduler, Duration)

Decorates the event stream with EventListenerDelayDecorator<TEvent>.

[Pure]
public static IEventStream<WithInterval<TEvent>> Delay<TEvent>(this IEventStream<TEvent> source, ITimestampProvider timestampProvider, Duration delay, TaskScheduler scheduler, Duration spinWaitDurationHint)

Parameters

source IEventStream<TEvent>

Source event stream.

timestampProvider ITimestampProvider

Timestamp provider to use for time tracking.

delay Duration

Event delay.

scheduler TaskScheduler

Task scheduler.

spinWaitDurationHint Duration

SpinWait duration hint for the underlying timer.

Returns

IEventStream<WithInterval<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.

Exceptions

ArgumentOutOfRangeException

When delay is less than 1 tick or greater than MaxValue milliseconds or when spinWaitDurationHint is less than 0.

RegisterTasks<TKey>(IEventStream<WithInterval<long>>, IEnumerable<ITimerTask<TKey>>)

Creates a new TimerTaskCollection<TKey> instance by registering a collection of ITimerTask<TKey> instances in the provided IEventStream.

[Pure]
public static TimerTaskCollection<TKey> RegisterTasks<TKey>(this IEventStream<WithInterval<long>> source, IEnumerable<ITimerTask<TKey>> tasks) where TKey : notnull

Parameters

source IEventStream<WithInterval<long>>

Source event stream.

tasks IEnumerable<ITimerTask<TKey>>

Collection of ITimerTask<TKey> instances to register.

Returns

TimerTaskCollection<TKey>

New TimerTaskCollection<TKey> instance.

Type Parameters

TKey

Task key type.

Exceptions

ArgumentException

When task keys are not unique.

WithInterval<TEvent>(IEventStream<TEvent>, ITimestampProvider)

Decorates the event stream with EventListenerWithIntervalDecorator<TEvent>.

[Pure]
public static IEventStream<WithInterval<TEvent>> WithInterval<TEvent>(this IEventStream<TEvent> source, ITimestampProvider timestampProvider)

Parameters

source IEventStream<TEvent>

Source event stream.

timestampProvider ITimestampProvider

Timestamp provider to use for time tracking.

Returns

IEventStream<WithInterval<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.

WithTimestamp<TEvent>(IEventStream<TEvent>, ITimestampProvider)

Decorates the event stream with EventListenerWithTimestampDecorator<TEvent>.

[Pure]
public static IEventStream<WithTimestamp<TEvent>> WithTimestamp<TEvent>(this IEventStream<TEvent> source, ITimestampProvider timestampProvider)

Parameters

source IEventStream<TEvent>

Source event stream.

timestampProvider ITimestampProvider

Timestamp provider to use for time tracking.

Returns

IEventStream<WithTimestamp<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.

WithZonedDateTime<TEvent>(IEventStream<TEvent>, IZonedClock)

Decorates the event stream with EventListenerWithZonedDateTimeDecorator<TEvent>.

[Pure]
public static IEventStream<WithZonedDateTime<TEvent>> WithZonedDateTime<TEvent>(this IEventStream<TEvent> source, IZonedClock clock)

Parameters

source IEventStream<TEvent>

Source event stream.

clock IZonedClock

Clock to use for time tracking.

Returns

IEventStream<WithZonedDateTime<TEvent>>

Decorated IEventStream<TEvent> instance.

Type Parameters

TEvent

Event type.