简体   繁体   English

Quartz.net作业调度

[英]Quartz.net job scheduling

how does Quartz.net work in the background. Quartz.net是如何在后台运行的。 suppose i have created a job which would get triggered next year. 假设我已经创建了一个明年会被触发的工作。 so what's happening in the background for one year. 那么在背景中发生了一年的事情。 . Is there a process or thread which keeps running continuously for one year.does it implement timer in the background? 是否有一个持续运行一年的进程或线程。它是否在后台实现计时器?

You need to start the Quartz scheduler. 您需要启动Quartz调度程序。 As long as the scheduler is running, Quartz will keep track of schedules and start jobs according to their schedule. 只要调度程序正在运行,Quartz就会跟踪计划并根据计划启动作业。 But as Quartz is a library hosted inside your application, you have to start the Quartz scheduler yourself. 但由于Quartz是在应用程序中托管的库,因此您必须自己启动Quartz调度程序。

In scenarios where you don't have an application that is always active (like a website), you have to find some way to let the Quartz scheduler run independent of that (for instance in a scheduler service dedicated to running your jobs). 在没有始终处于活动状态的应用程序(如网站)的情况下,您必须找到一些方法让Quartz调度程序独立运行(例如,在专用于运行作业的调度程序服务中)。 I've found a few references to using Quartz.net in ASP.Net projects, but I have no personal experience with running Quartz within a website. 我在ASP.Net项目中找到了一些使用Quartz.net的参考资料,但我没有在网站中运行Quartz的个人经验。 I don't know how Quartz would react to IIS shutting down or reusing the application pool your site is running in. But if your job can handle being aborted, it may be a viable option. 我不知道Quartz会如何响应IIS关闭或重用您的站点运行的应用程序池。但是如果您的工作可以处理中止,那么它可能是一个可行的选择。 You'd have to start the scheduler in the Application_Start event in your Global class. 您必须在Global类的Application_Start事件中启动调度Application_Start

No matter how you run Quartz, you will want to use a non-volatile job store. 无论您如何运行Quartz,您都希望使用非易失性的作业存储。 Quartz can store the scheduled jobs in memory, but you'd have to re-schedule all jobs after each application start. Quartz可以将预定作业存储在内存中,但您必须在每次应用程序启动后重新安排所有作业。 So it is highly recommended to use another job store that can persist jobs between application restarts. 因此,强烈建议使用另一个可以在应用程序重新启动之间保留作业的作业存储。

The Quartz.net quick-start tutorial has bits of code to show you how to use Quartz in your application. Quartz.net 快速入门教程提供了一些代码,向您展示如何在您的应用程序中使用Quartz。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM