因爲我如今使用的Quartz.NET2.2版本,相對2.x變化不大,主要是相對於1.x更新了不少東西,以下基礎知識摘錄網絡。
Quartz.NET是一個開源的做業調度框架,是OpenSymphony 的 Quartz API的.NET移植,它用C#寫成,可用於winform和asp.net應用中。它提供了巨大的靈活性而不犧牲簡單性。你可以用它來爲執行一個做業而建立簡單的或複雜的調度。它有不少特徵,如:數據庫支持,集羣,插件,支持cron-like表達式等等。
Quartz.NET框架的核心是調度器。調度器負責管理Quartz.NET應用運行時環境。Quartz不單單是線程和線程管理。爲確保可伸縮性,Quartz.NET採用了基於多線程的架構。啓動時,框架初始化一套worker線程,這套線程被調度器用來執行預約的做業。這就是Quartz.NET怎樣能併發運行多個做業的原理。Quartz.NET依賴一套鬆耦合的線程池管理部件來管理線程環境。做業是一個執行任務的簡單.NET類。只需實現Quartz.IJob接口,IJob接口包含惟一的一個方法Execute(),做業從這裏開始執行。一旦實現了IJob接口和Execute ()方法,當Quartz.NET肯定該是做業運行的時候,它將調用做業。Execute()方法內就是要作的事情。html
API 操做簡單,只要幾行簡單的代碼你就能夠在應用程序裏面實現本身的做業調度,並實時監視做業執行狀況
觸發器功能強大,比 Windows 的任務計劃提供更細的觸發粒度,你可使用Cron表達式來實現如每週星期一到星期五8:00am,5:00pm(工做時間)執行某一件任務
良好的可擴展性,它基於接口編程,你能夠實現本身的 Schedule 調度器,Job 做業,以及 Trigger 觸發器等
做業能夠保存在 RAM 中,也能夠持久化到數據庫,支持多種數據庫類型:SqlServer、Oracle、MySql等
集羣,這是一個高級應用,能夠在多臺計算機之間建立負載平衡、容錯處理sql
2012年4月9日 Quartz.NET 2.0發佈了Released版,對應於Java Quartz的2.1版本,下載地址 http://quartznet.sourceforge.net/download.html 。整個版本相對於1.0版本進行了大量的修改,單元測試的代碼更友好(重構了更多的接口),API是基於泛型和.NET 3.5 SP1以後的特性,例如DateTimeOffset。這是Quartz.NET 有史以來最大的、最值得興奮的一個版本。數據庫
該版本除了在性能上有所提高外,增長了以下新特性編程
2.0在API上也作了重大的修改,API返回值的集合和泛型的使用,消除歧義和冗餘代碼,掩藏/刪除不該該公開給客戶端的方法,提升關注點分離,並引入 與領域特定語言DSL的核心實體(jobs and triggers),天然就有了兼容性等問題,咱們如今來看下都有哪些重大的修改:網絡
IJobDetail job = JobBuilder.Create<SimpleJob>() .WithIdentity("job1", "group1") .Build(); ITrigger trigger = TriggerBuilder.Create() .WithIdentity("trigger1", "group1") .StartAt(DateBuilder.FutureDate(2, IntervalUnit.HOURS)) .WithSimpleSchedule(x => x.RepeatHourlyForever()) .ModifiedByCalendar("holidays") .Build();
This release contains important bug fixes, new functionality and minor breaking changes.
UPGRADING
Please examine and run the database\schema_20_to_22_upgrade.sql script if you are using AdoJobStore
this script adds a new column SCHED_TIME to table QRTZ_FIRED_TRIGGERS
file contains the alter command for SQL Server and other database samples in comments
BREAKING CHANGES
database schema needs upgrade
add SchedulerStarting() method to ISchedulerListener interface
make the scheduler's TypeLoadHelper available to plugins when they are initialized
dbFailureRetryInterval parameter was removed from DirectSchedulerFactory APIs
NEW FEATURES
ability to override worker thread names (when using SimpleThreadPool)
add new IScheduler method: ScheduleJob(IJobDetail job, ISet trigger) to schedule multiple triggers for a job all at once
allow 'triggerless' initial storing of non-durable jobs.
improvements for job recovery information
package job_scheduling_data_2_0.xsd to nuget package's content folder
allow scheduler exported with remoting to be used from local machine only
support for Oracle managed ODP driver
FIXES
job ending with exception and trigger not going to fire again, trigger is incorrectly not removed from job store
XML schema supports multiple schedule elements but processor does not
DailyTimeIntervalTriggerPersistenceDelegate does not handle empty time interval properly
DailyTimeIntervalScheduleBuilder.EndingDailyAfterCount(...) doesn't pass validation
trace throwing exception
bug in QuartzSchedulerThread.GetRandomizedIdleWaitTime()
can't delete or replace job without the referenced class
MISC
Performance improvements, including improvements to some select statements in AdoJobStore多線程