Skip to content

SystemTarget.RegisterGrainTimer(Func<TState, CancellationToken, Task>, TState, TimeSpan, TimeSpan)

RegisterGrainTimer(Func<TState, CancellationToken, Task>, TState, TimeSpan, TimeSpan)

View source
public IGrainTimer RegisterGrainTimer<TState>(Func<TState, CancellationToken, Task> callback, TState state, TimeSpan dueTime, TimeSpan period)
Registers a timer to send regular callbacks to this grain. This timer will keep the current grain from being deactivated.

Parameters

callbackFunc<TState, CancellationToken, Task>
The timer callback, which will fire whenever the timer becomes due.
stateTState
The state object passed to the callback.
dueTimeTimeSpan
The amount of time to delay before the callback is invoked. Specify System.Threading.Timeout.InfiniteTimeSpan to prevent the timer from starting. Specify System.TimeSpan.Zero to invoke the callback promptly.
periodTimeSpan
The time interval between invocations of callback. Specify System.Threading.Timeout.InfiniteTimeSpan to disable periodic signaling.

Returns

An System.IDisposable object which will cancel the timer upon disposal.