|
1 | 1 | ---
|
2 | 2 | title: Reliable Actors timers and reminders
|
3 | 3 | description: Introduction to timers and reminders for Service Fabric Reliable Actors, including guidance on when to use each.
|
4 |
| -author: vturecek |
5 |
| - |
6 | 4 | ms.topic: conceptual
|
7 | 5 | ms.date: 11/02/2017
|
8 |
| -ms.author: vturecek |
9 | 6 | ---
|
10 | 7 | # Actor timers and reminders
|
11 | 8 | Actors can schedule periodic work on themselves by registering either timers or reminders. This article shows how to use timers and reminders and explains the differences between them.
|
@@ -117,12 +114,17 @@ The next period of the timer starts after the callback completes execution. This
|
117 | 114 |
|
118 | 115 | The Actors runtime saves changes made to the actor's State Manager when the callback finishes. If an error occurs in saving the state, that actor object will be deactivated and a new instance will be activated.
|
119 | 116 |
|
| 117 | +Unlike [reminders](#actor-reminders), timers can't be updated. If `RegisterTimer` is called again, a new timer will be registered. |
| 118 | + |
120 | 119 | All timers are stopped when the actor is deactivated as part of garbage collection. No timer callbacks are invoked after that. Also, the Actors runtime does not retain any information about the timers that were running before deactivation. It is up to the actor to register any timers that it needs when it is reactivated in the future. For more information, see the section on [actor garbage collection](service-fabric-reliable-actors-lifecycle.md).
|
121 | 120 |
|
122 | 121 | ## Actor reminders
|
123 |
| -Reminders are a mechanism to trigger persistent callbacks on an actor at specified times. Their functionality is similar to timers. But unlike timers, reminders are triggered under all circumstances until the actor explicitly unregisters them or the actor is explicitly deleted. Specifically, reminders are triggered across actor deactivations and failovers because the Actors runtime persists information about the actor's reminders using actor state provider. Please note that the reliability of reminders is tied to the state reliability guarantees provided by the actor state provider. This means that for actors whose state persistence is set to None, the reminders will not fire after a failover. |
| 122 | +Reminders are a mechanism to trigger persistent callbacks on an actor at specified times. Their functionality is similar to timers. But unlike timers, reminders are triggered under all circumstances until the actor explicitly unregisters them or the actor is explicitly deleted. Specifically, reminders are triggered across actor deactivations and failovers because the Actors runtime persists information about the actor's reminders using actor state provider. Also unlike timers, existing reminders can be updated by calling the registration method (`RegisterReminderAsync`) again using the same *reminderName*. |
| 123 | + |
| 124 | +> [!NOTE] |
| 125 | +> The reliability of reminders is tied to the state reliability guarantees provided by the actor state provider. This means that for actors whose state persistence is set to *None*, the reminders will not fire after a failover. |
124 | 126 |
|
125 |
| -To register a reminder, an actor calls the `RegisterReminderAsync` method provided on the base class, as shown in the following example: |
| 127 | +To register a reminder, an actor calls the [`RegisterReminderAsync`](https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.actors.runtime.actorbase.registerreminderasync?view=azure-dotnet#remarks) method provided on the base class, as shown in the following example: |
126 | 128 |
|
127 | 129 | ```csharp
|
128 | 130 | protected override async Task OnActivateAsync()
|
|
0 commit comments