Interface ITimerScheduler
Support for scheduled "Self" messages in an actor.
Timers are bound to the lifecycle of the actor that owns it, and thus are cancelled automatically when it is restarted or stopped.
ITimerScheduler is not thread-safe, i.e.it must only be used within the actor that owns it.
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public interface ITimerScheduler
Properties
| Edit this page View SourceActiveTimers
Retrieves all current active timer keys
Declaration
IReadOnlyCollection<object> ActiveTimers { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<object> |
Methods
| Edit this page View SourceCancel(object)
Cancel a timer with a given key.
If canceling a timer that was already canceled, or key never was used to start a timer
this operation will do nothing.
It is guaranteed that a message from a canceled timer, including its previous incarnation for the same key, will not be received by the actor, even though the message might already be enqueued in the mailbox when cancel is called.
Declaration
void Cancel(object key)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
CancelAll()
Cancel all timers.
Declaration
void CancelAll()
IsTimerActive(object)
Check if a timer with a given key is active.
Declaration
bool IsTimerActive(object key)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key |
Returns
| Type | Description |
|---|---|
| bool | Name of timer |
StartPeriodicTimer(object, object, TimeSpan)
Start a periodic timer that will send msg to the "Self" actor at
a fixed interval.
Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
Declaration
void StartPeriodicTimer(object key, object msg, TimeSpan interval)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
| object | msg | Message to schedule |
| TimeSpan | interval | Interval |
StartPeriodicTimer(object, object, TimeSpan, IActorRef)
Start a periodic timer that will send msg to the "Self" actor at
a fixed interval.
Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
Declaration
void StartPeriodicTimer(object key, object msg, TimeSpan interval, IActorRef sender)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
| object | msg | Message to schedule |
| TimeSpan | interval | Interval |
| IActorRef | sender | The sender override for the timer message |
StartPeriodicTimer(object, object, TimeSpan, TimeSpan)
Start a periodic timer that will send msg to the "Self" actor at
a fixed interval.
Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
Declaration
void StartPeriodicTimer(object key, object msg, TimeSpan initialDelay, TimeSpan interval)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
| object | msg | Message to schedule |
| TimeSpan | initialDelay | Initial delay |
| TimeSpan | interval | Interval |
StartPeriodicTimer(object, object, TimeSpan, TimeSpan, IActorRef)
Start a periodic timer that will send msg to the "Self" actor at
a fixed interval.
Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
Declaration
void StartPeriodicTimer(object key, object msg, TimeSpan initialDelay, TimeSpan interval, IActorRef sender)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
| object | msg | Message to schedule |
| TimeSpan | initialDelay | Initial delay |
| TimeSpan | interval | Interval |
| IActorRef | sender | The sender override for the timer message |
StartSingleTimer(object, object, TimeSpan)
Start a timer that will send msg once to the "Self" actor after
the given timeout.
Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
Declaration
void StartSingleTimer(object key, object msg, TimeSpan timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
| object | msg | Message to schedule |
| TimeSpan | timeout | Interval |
StartSingleTimer(object, object, TimeSpan, IActorRef)
Start a timer that will send msg once to the "Self" actor after
the given timeout.
Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
Declaration
void StartSingleTimer(object key, object msg, TimeSpan timeout, IActorRef sender)
Parameters
| Type | Name | Description |
|---|---|---|
| object | key | Name of timer |
| object | msg | Message to schedule |
| TimeSpan | timeout | Interval |
| IActorRef | sender | The sender override for the timer message |
Edit this page