OrleansContrib/Orleans.Providers.MongoDB

Call to RegisterOrUpdateReminder throws exception: "No service for type 'Orleans.Timers.IReminderRegistry' has been registered."

htxryan opened this issue · 4 comments

Hello!

I'm facing an issue when upgrading from 3.x to 7.

Calls to RegisterOrUpdateReminder() from grains that implement IRemindable throw exceptions: "No service for type 'Orleans.Timers.IReminderRegistry' has been registered."

As noted here, a reference to Microsoft.Orleans.Reminders has been added.

NOTE: Changing from the MongoDB provider to the in-memory reminder service DOES make this issue go away. So this might be an issue with this library rather than Orleans itself. If someone reading this believes it is an Orleans issue, let me know. I'm going to open this same issue there just in case (dotnet/orleans#8177).

Stack trace:

System.InvalidOperationException: No service for type 'Orleans.Timers.IReminderRegistry' has been registered.
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Orleans.GrainReminderExtensions.GetReminderRegistry(IGrainContext grainContext) in /_/src/Orleans.Reminders/GrainReminderExtensions.cs:line 125
   at Orleans.GrainReminderExtensions.RegisterOrUpdateReminder(Boolean remindable, IGrainContext grainContext, String reminderName, TimeSpan dueTime, TimeSpan period) in /_/src/Orleans.Reminders/GrainReminderExtensions.cs:line 52
   at Orleans.GrainReminderExtensions.RegisterOrUpdateReminder(Grain grain, String reminderName, TimeSpan dueTime, TimeSpan period) in /_/src/Orleans.Reminders/GrainReminderExtensions.cs:line 29
   at [ grain function]...

Have you called AddReminders similar to how it's done in our integration test?

@wassim-k Bingo, that worked! You rock -- thank you for the quick help. Did I just overlook it, or was this not mentioned in the Orleans upgrade docs? Reminders were working for us in 3.x without this call, so it seems like a 7.x breaking change.

Yeh, I haven't seen a reference to it in the docs either. I had do some digging into Orleans code to work it out.

@wassim-k I created a PR to add this call automatically, so no one else gets hung up on this; #116