Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle application shutdown in Quartz.Net

I have used Quartz.Net for queuing and sending emails from my application. I don't know how each scheduled job responds to application instance stopping, pausing or shutting down. The IJob interface has no method that can notify a running job about these events.

My question is how can I handle these cases when they occur so that the job can exit while leaving the application and the data in a stable state?

like image 214
Roman Avatar asked Sep 26 '10 21:09

Roman


1 Answers

Make sure you call IScheduler.Shutdown(true) when your application shuts down. This will wait for all jobs to finish and ensure everything is cleaned up correctly.

like image 172
Mauricio Scheffer Avatar answered Sep 24 '22 10:09

Mauricio Scheffer