Reputation: 32104
Suppose I have a reliable actor that registers a reminder in OnActivateAsync
. This reminder has a period
that is retrieved from some persistent storage. After some time the actor is garbage-collected.
After some more time the actor is called or the reminder fires and OnActivateAsync
is called by the runtime. In the meantime, I updated the reminder period
in persistent storage.
What happens now? I attempt to register the reminder again but with a different period
. Will the reminder be updated with the new period
?
Another case is an update of the actor. Suppose the period
is hard-coded but a new version of the actor uses a different period
. What happens now when OnActivateAsync
is called and the reminder is registered again?
Upvotes: 2
Views: 1327
Reputation: 26
When you try to register an existing reminder again, it will be updated. From RegisterReminderAsync
documentation (https://learn.microsoft.com/en-us/dotnet/api/microsoft.servicefabric.actors.runtime.actorbase.registerreminderasync?view=azure-dotnet):
Existing reminders can also be updated by calling this method again.
Upvotes: 1
Reputation: 1150
So when the first time your reminder fires, it's up to you to check if the period has been updated and the unregister the existing reminder and register a new one.
You can't update the existing reminder - use GetReminder
to see if it exists and then unregister it and create a new one.
```
var reminder = GetReminder(reminderName);
if (reminder != null)
{
// do something with it...
}
```
In the case when the actor code is upgraded and you have a hard coded period in code (that's changed), with the guard, you wouldn't register/update the existing reminder.
Upvotes: 2