How to deal with closing an application in Quartz.Net

I used Quartz.Net to queue and send emails from my application. I do not know how each scheduled task responds to application shutdown, suspension or shutdown. The IJob interface does not have a method that can notify the current job of these events.

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

+4
source share
1 answer

Make sure you call IScheduler.Shutdown(true) when the application closes. This will wait for the completion of all tasks and ensure proper cleaning.

+4
source

All Articles