Table of Contents

Interface ITimerTask<TKey>

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

Represents a reactive task that can be registered in an IEventStream<TEvent> with WithInterval<TEvent> events.

public interface ITimerTask<TKey> : IDisposable where TKey : notnull

Type Parameters

TKey

Task key type.

Inherited Members

Properties

Key

Underlying key.

TKey Key { get; }

Property Value

TKey

MaxConcurrentInvocations

Specifies the maximum number of concurrently running invocations.

int MaxConcurrentInvocations { get; }

Property Value

int

MaxEnqueuedInvocations

Specifies the maximum number of invocations that can be enqueued due to maximum concurrency.

int MaxEnqueuedInvocations { get; }

Property Value

int

NextInvocationTimestamp

Specifies the Timestamp of the next task invocation. Lack of value means that the task will be invoked on every event stream's event.

Timestamp? NextInvocationTimestamp { get; }

Property Value

Timestamp?

Methods

InvokeAsync(TimerTaskCollection<TKey>, ReactiveTaskInvocationParams, CancellationToken)

Invokes the task.

Task InvokeAsync(TimerTaskCollection<TKey> source, ReactiveTaskInvocationParams parameters, CancellationToken cancellationToken)

Parameters

source TimerTaskCollection<TKey>

Source timer task collection.

parameters ReactiveTaskInvocationParams

Invocation parameters.

cancellationToken CancellationToken

CancellationToken instance.

Returns

Task

OnCompleted(TimerTaskCollection<TKey>, ReactiveTaskCompletionParams)

Callback for task invocation completion.

void OnCompleted(TimerTaskCollection<TKey> source, ReactiveTaskCompletionParams parameters)

Parameters

source TimerTaskCollection<TKey>

Source timer task collection.

parameters ReactiveTaskCompletionParams

Completion parameters.

OnEnqueue(TimerTaskCollection<TKey>, ReactiveTaskInvocationParams, int)

Callback invoked before the task invocation gets enqueued due to maximum concurrency.

bool OnEnqueue(TimerTaskCollection<TKey> source, ReactiveTaskInvocationParams parameters, int positionInQueue)

Parameters

source TimerTaskCollection<TKey>

Source timer task collection.

parameters ReactiveTaskInvocationParams

Invocation parameters.

positionInQueue int

Invocation's position in queue.

Returns

bool

true to proceed with enqueueing, false to cancel the invocation.