Search code examples
.netscheduled-tasksschedulerakka.netorleans

Scheduler / Notification Service Recommendations / Architecture Decision


I have a requirement to create a Push Notification Service (Which I have done via SignalR/WebAPI) and a Future Task Runner / Scheduler that can be run at a certain date / time or at some recurring interval.

An example of the use case would be a Payment reminder service, if payment is still not paid by the due date, the system would send a notification to the "admin" and an Email/SMS to the "consumer". Reminder can be snoozed to a further date or updated to a new dateline, manually or automatically.

Potentially the Scheduler service can be used for anything else, like setting manual Todos, Recurring reminders, future email/SMS send date etc... And am looking at potentially thousands of newsletter emails per datetime etc...

I have looked into a few options

1) Quartz.net / Hangfire / Background tasks

--> Can either run in asp.net or as a windows service.

--> Has scheduled tasks/ recurring support etc...

--> Seems overly complicated to me, and probably not as efficient if coupled with the asp.net service, not as scalable, needs to design it well for future proofing... need to set up extra store?

2) Tasks Scheduler

--> Not so feasible with my scorched earth / pheonix deployments scenarios

3) External Services

--> Azure Scheduler

--> AWS Cloudwatch Scheduler / Events (Can also trigger SNS / Lambda etc...)

--> Seems like a very good decoupled solution, but maintenance / testing / durability might be an issue? Need to set up properly depending on solution... Dunno how to get "12 Factor's App"'s prod/dev parity testing etc...

4) Event Driven Message Bus

--> Buses has good durability and reliability, but gets complicated if I want to cancel etc..?

--> Limit in future schedule, like I think SQS only has 15 days limit or something like that.

5) Actor Model

--> Akka.net or Orleans, Seems simple to setup, haven't used it yet, but seems to have a lot of things that fit the bill, small actors that does specific tasks, schedulers, high performance, easy to add cluster for more jobs (every logic is per actor, rest is configurations), easy to reproduce locally and good...single unit of work actor makes a lot of sense to me.

--> No experience with it, but is it gonna be overkill for my scenario? Seems like a good future proof thing as well, for a full blown scheduler.

--> Neg. no dotnet core support yet

Any other suggestions welcomed...I need to complete it in 2 weeks.

P.S. Really wonder what is Google Now Reminders' architecture...that is one cool service "Remind me to do something at sometime" and it just works.


Solution

  • Have you noticed that Orleans has a built-in mechanism called "Reminders" ( also called "Persistent Timers"), which sounds like exactly what you are asking for.

    https://dotnet.github.io/orleans/docs/grains/timers_and_reminders.html

    .NET Core support is coming.