ActorBase.RegisterTimer Method

Definition

Registers a Timer for the actor.

protected Microsoft.ServiceFabric.Actors.Runtime.IActorTimer RegisterTimer (Func<object,System.Threading.Tasks.Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period);
member this.RegisterTimer : Func<obj, System.Threading.Tasks.Task> * obj * TimeSpan * TimeSpan -> Microsoft.ServiceFabric.Actors.Runtime.IActorTimer
Protected Function RegisterTimer (asyncCallback As Func(Of Object, Task), state As Object, dueTime As TimeSpan, period As TimeSpan) As IActorTimer

Parameters

asyncCallback
Func<Object,Task>

A delegate that specifies a method to be called when the timer fires. It has one parameter: the state object passed to RegisterTimer. It returns a Task representing the asynchronous operation.

state
Object

An object containing information to be used by the callback method, or null.

dueTime
TimeSpan

The amount of time to delay before the async callback is first invoked. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately.

period
TimeSpan

The time interval between invocations of the async callback. Specify negative one (-1) milliseconds to disable periodic signaling.

Returns

Returns IActorTimer object.

Applies to