9

I am developing an email marketing WinForm application. And for the scheduling of campaigns, I decided to use Quartz.NET. I need it to be running as a Windows Service. but I also want the user to be able to add a job (e.g. a campaign that needs to be run everyday at 8 AM which is basically running a .bat file) to the service through the program.

I am also saving all the job schedules in the database so that when you stop/start the OS or Windows Service it can still read from all the jobs that need to be run.

How can I add a job to the service while the service is running? The dynamic addition/removal of the job to the service is of course much preferred. Stopping the service and reading all the jobs again from the database is, to be frank, my last resort.

disasterkid
  • 6,948
  • 25
  • 94
  • 179

1 Answers1

10

You can install Quartz.Net as a windows service and configure it to use AdoJobStore.
Your WinForm application will be the interface where you can add, suspend and remove jobs and triggers.

You do not have to stop your windows services while you're doing that.

You do not need to read your database to figure out what's happening in Quartz but you must use the APIs provided.

I've done something similar long time ago; my quartz.net "manager" was a web application.

You can read my answer here.

I guess the steps to do what you're looking for a pretty much the same.

Reference to Quartz.net samples and a free book can be found here and here.

Community
  • 1
  • 1
LeftyX
  • 35,328
  • 21
  • 132
  • 193
  • 2
    thanks! it was only through other blogs that I realized you can install Quartz.NET as a Windows Service. I guess this is a typical approach when you would like to schedule jobs to be running regardless of your main application. How come there is no single mentioning of this option on Quartz.NET's official site? – disasterkid Sep 19 '14 at 10:40
  • Documentation is quite poor. You can find more info on Jay Vilalta's Blog (see updated answer). – LeftyX Sep 19 '14 at 11:19
  • 1
    Feel free to accept answers (and upvote) if you're happy with the answers. That's the way SO works. – LeftyX Sep 19 '14 at 11:21
  • thank you. yes i guess i would have to do more research on Quartz.NET. The documentation on the official site is nowhere near enough. – disasterkid Sep 19 '14 at 11:24
  • The blog I've suggested and the book contain all the things you need to start. So many questions have been asked on Quartz.Net on SO. You'll find pretty much everything you need going through the answers here. Cheers. – LeftyX Sep 19 '14 at 11:26