1

I'm trying to create a project with net core 2.0. Users can create reminders in distant future in my system (the reminder call weapi method in distant future). Reminders save in database (I choose the database now). Nuget-package Quartz.NET can create reminders in future. But what if server will be restarted?
The main idea is : in startup.cs recreate reminders in Quartz.NET. I don't like this idea, because maybe there will be a lot of reminders. Have you got any ideas about how can I do it?

Galina Melnik
  • 1,947
  • 3
  • 14
  • 19
  • 2
    Use TaskSchaduler check this example https://stackoverflow.com/questions/49258557/how-to-change-windowtaskscheduler-rundurationfor-to-indefinitely/49267282#49267282 you need to added one line of code to make it start on system boot, if you can not figure it out let me know so I can answer you when I get home – Maytham Fahmi Jun 27 '18 at 05:13
  • 2
    Unless you really intend to run your .NET Core code on non-Windows environments, as @maytham-ɯɐɥʇʎɐɯ says, use _Windows Task Scheduler_. It is easily accessible from c#; runs as a Windows Service and so no login required; doesn't require a database –  Jun 27 '18 at 05:23

1 Answers1

2

Quatrz.net allows you to choose JobStore, so you can restore all your jobs after application restart. Another alternative is to use Hangfire which provides a lot of persistence options out of the box.

Alex Riabov
  • 8,655
  • 5
  • 47
  • 48
  • How if you want to Schedule a task in Windows environment would Hangfire create the tasks in Windows? – Maytham Fahmi Jun 27 '18 at 05:32
  • @maytham-ɯɐɥʇʎɐɯ if you need Windows task, Hangfire won't create them unless you write code to do that, but there is no mentions of Windows tasks in initial question. – Alex Riabov Jun 27 '18 at 05:39
  • 1
    That is correct but the idea of quartz, task scheduler to create tasks in Windows scheduler so they can start on for instance on windows startup after server restart, that is the point – Maytham Fahmi Jun 27 '18 at 05:42