quartz 2.0 与1.0功能对比

日常开发来说,相对于1.0版,2.0版在使用上有以下几点需要注意的变化

变化一 比1.0多引用了C5.dll

  • C5.dll 一个C#和其他CLI语言的泛型集合类。.Net2.0及以上才可以使用。简介地址:http://www.itu.dk/research/c5/

变化二 quartz.config有细微变化

  • quartz.plugin.xml.type由1.x的Quartz.Plugin.Xml.JobInitializationPlugin, Quartz变为了2.0中的Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
  • 2.0版本新增了一行配置quartz.scheduler.exporter.channelName = httpQuart
  • 1.0 quartz.config

     1 # You can configure your scheduler in either <quartz> configuration section
     2 # or in quartz properties file
     3 # Configuration section has precedence
     4
     5 quartz.scheduler.instanceName = ServerScheduler
     6
     7 # configure thread pool info
     8 quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
     9 quartz.threadPool.threadCount = 10
    10 quartz.threadPool.threadPriority = Normal
    11
    12 # job initialization plugin handles our xml reading, without it defaults are used -->
    13 quartz.plugin.xml.type = Quartz.Plugin.Xml.JobInitializationPlugin, Quartz
    14 quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
    15
    16 # export this server to remoting context
    17 quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
    18 quartz.scheduler.exporter.port = 555
    19 quartz.scheduler.exporter.bindName = QuartzScheduler
    20 quartz.scheduler.exporter.channelType = tcp

  • 2.0 quartz.config

     1 # You can configure your scheduler in either <quartz> configuration section
     2 # or in quartz properties file
     3 # Configuration section has precedence
     4
     5 quartz.scheduler.instanceName = ServerScheduler
     6
     7 # configure thread pool info
     8 quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
     9 quartz.threadPool.threadCount = 10
    10 quartz.threadPool.threadPriority = Normal
    11
    12 # job initialization plugin handles our xml reading, without it defaults are used
    13 quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
    14 quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
    15
    16 # export this server to remoting context
    17 quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
    18 quartz.scheduler.exporter.port = 555
    19 quartz.scheduler.exporter.bindName = QuartzScheduler
    20 quartz.scheduler.exporter.channelType = tcp
    21 quartz.scheduler.exporter.channelName = httpQuartz

变化三 实现IJob接口 JobExecutionContext对象变成了IJobExecutionContext 

  • 1.0 IJob接口  

     public class SimpleJob : IJob
        {
            #region IJob 成员
    
            public void Execute(JobExecutionContext context)
            {
                throw new NotImplementedException();
            }
    
            #endregion
        }

  • 2.0 IJob接口

     public class SimpleJob : IJob
        {
            #region IJob 成员
    
            public void Execute(IJobExecutionContext context)
            {
                throw new NotImplementedException();
            }
    
            #endregion
        }

变化四 quartz_jobs.xml配置节发生了变化

  • 根结点有<quartz>变为了<job-scheduling-data>
  • 新增了<schedule>节点,<job>均放在<schedule>节点下,删除了 <job-detail>节点,同时删除了<volatile>false</volatile>属性
  • <trigger>不在放置在<job>下面,改为和<job>平行
  • 1.0 quartz_jobs.xml示例

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" overwrite-existing-jobs="true">
     3
     4   <job>
     5     <job-detail>
     6       <name>sampleJob</name>
     7       <group>sampleGroup</group>
     8       <description>Sample job for Quartz Server</description>
     9       <job-type>Quartz.Job.NoOpJob, Quartz</job-type>
    10       <volatile>false</volatile>
    11       <durable>true</durable>
    12       <recover>false</recover>
    13     </job-detail>
    14     <trigger>
    15       <simple>
    16         <name>sampleSimpleTrigger</name>
    17         <group>sampleSimpleGroup</group>
    18         <description>Simple trigger to simply fire sample job</description>
    19         <misfire-instruction>SmartPolicy</misfire-instruction>
    20         <volatile>false</volatile>
    21         <job-name>sampleJob</job-name>
    22         <job-group>sampleGroup</job-group>
    23         <repeat-count>RepeatIndefinitely</repeat-count>
    24         <repeat-interval>3000</repeat-interval>
    25       </simple>
    26     </trigger>
    27   </job>
    28
    29   <job>
    30     <job-detail>
    31       <name>sampleJob2</name>
    32       <group>sampleGroup2</group>
    33       <description>Sample job for Quartz Server</description>
    34       <job-type>Quartz.Job.NoOpJob, Quartz</job-type>
    35       <volatile>false</volatile>
    36       <durable>true</durable>
    37       <recover>false</recover>
    38     </job-detail>
    39     <trigger>
    40       <cron>
    41         <name>sampleSimpleTrigger2</name>
    42         <group>sampleSimpleTrigger2</group>
    43         <job-name>sampleJob2</job-name>
    44         <job-group>sampleGroup2</job-group>
    45         <cron-expression>0/10 * * * * ?</cron-expression>
    46       </cron>
    47     </trigger>
    48   </job>
    49 </quartz>

  • 2.0 quartz_jobs.xml示例

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- This file contains job definitions in schema version 2.0 format -->
    
    <job-scheduling-data xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
    
      <processing-directives>
        <overwrite-existing-data>true</overwrite-existing-data>
      </processing-directives>
    
      <schedule>
    
        <job>
            <name>sampleJob</name>
            <group>sampleGroup</group>
            <description>Sample job for Quartz Server</description>
            <job-type>Quartz.Server.SampleJob, Quartz.Server</job-type>
            <durable>true</durable>
            <recover>false</recover>
        </job>
        <trigger>
          <simple>
            <name>sampleSimpleTrigger</name>
            <group>sampleSimpleGroup</group>
            <description>Simple trigger to simply fire sample job</description>
            <job-name>sampleJob</job-name>
            <job-group>sampleGroup</job-group>
            <misfire-instruction>SmartPolicy</misfire-instruction>
            <repeat-count>-1</repeat-count>
            <repeat-interval>10000</repeat-interval>
          </simple>
        </trigger>
    
        <job>
          <name>CommissionJob</name>
          <group>CommissionJob</group>
          <description>Sample job for Quartz Server</description>
          <job-type>Settlement.Jobs.CommissionJob, Settlement.Jobs</job-type>
          <durable>true</durable>
          <recover>false</recover>
        </job>
         <trigger>
          <cron>
            <name>sampleSimpleTrigger2</name>
            <group>sampleSimpleTrigger2</group>
            <job-name>sampleJob2</job-name>
            <job-group>sampleGroup2</job-group>
            <cron-expression>0/10 * * * * ?</cron-expression>
          </cron>
        </trigger>
      </schedule>
    </job-scheduling-data>

变化五 支持.Net版本不同

  • Quartz 1.0可以支持.Net 1.1 和 .Net 2.0及以上版本
  • Quartz 2.0仅支持.Net 3.5及以上版本,放弃了对.Net 1.1和.Net 2.0的支持

quartz 2.0 与1.0功能对比

时间: 2024-07-30 15:37:12

quartz 2.0 与1.0功能对比的相关文章

.net Mongo Driver 1.0与2.0的对比与2.0的优化

前言 最近闲的时间有点多,所以还是写博客吧. 有人说Mongo 2.0的写法难以把控,好多地方不知道咋用,所以坚持用1.0(不愿意去尝试2.0),我感觉不可理解.所以写篇博客比较下. Mongo C#驱动1.0到2.0设计方面的差别非常大. 正文 先说1.0吧,更像是Mongo 各功能的直译,所以写法与mongo原生查询修改等比较类似,易上手.但是设计上确实存在很多问题.简单说几点: a.在query的构建方面,虽然有问题,但是勉强能接受 1 var modelCursor = collecti

C#最新功能(6.0、7.0)

原文:C#最新功能(6.0.7.0) 一直用C#开发程序,.NET的功能越来越多,变化也挺大的,从最初的封闭,到现在的开源,功能不断的增加,一直在进步.作为C#的强烈支持者,C#的变化,我不能不关注,这篇文章主要介绍,C#6.0和C#7.0增加的功能.C#的发展史和.NET以前的版本,请看C#和.NET版本,这边文章中有介绍. C# 6.0版 1. 静态导入 using static 增强功能可用于导入单个类的静态方法.例如:using static System.String;可以直接用Str

C# 7.0 中的新增功能

来源:Mark Michaelis 链接:msdn.microsoft.com/magazine/mt790184   解构函数 从 C# 1.0 开始,就能调用函数,就是将参数组合起来并封装到一个类中的构造函数.但是,从来没有一种简便的方式可将对象解构回其各个组成部分.例如,假设有一个 PathInfo 类,它采用文件名的每个元素(目录名.文件名.扩展名),并将它们组合成一个对象,然后支持操作对象的不同元素.现在,假设你需要将该对象提取(解构)回其各个组成部分. 在 C# 7.0 中,通过解构

vSphere 6.0 U1发布新功能说明

如您所知,VMworld2015上对于vSphere并没有什么太多提及,但是,Virtual SAN却是一个重要话题.而Virutual SAN内置于vSphere里面.所以,更新Virtual SAN 6.1的方式就是升级vSphere平台.所以,vSphere 6.0 U1快速发布了,这个版本的vSphere其实除了Virtual SAN 6.1外,没有什么太多新东西增加,具体清单如下:8 V0 ~) @& z Q3 x$ M/ n' H2 E) u7 o D% I4 {$ q3 \; L-

.NET Framework 1.1、2.0、3.0、3.5、4.0各版本新增功能

一..NET Framework 1.1版本 1.ASP.NET移动控件 2.ADO.NET的改动 添加System.Data.Odbc命名空间 新增System.Data.OracleClient命名空间供Oracle使用 DataReader对象公开HasRows属性,判断是否有返回行 Connection对象具有EnlistDistributedTransaction,可以在分布式事务中启动手动登记. 3.并发执行 .NET Framework 1.1版本支持并行执行. 4..NET Fr

AndroidStudio3.0 下载使用新功能介绍

"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> AndroidStudio3.0 下载使用新功能介绍 - 天平 - 博客频道 - CSDN.NET 天平 向着目标一步一步走. 目录视图 摘要视图 订阅 [活动]2017 CSDN博客专栏评选 &nbsp [5月书讯]流畅的Python,终于等到你!    &

OAuth2.0与1.0的对比总结

云计算引出了大量的开放平台,各种第三方应用建立在开放平台之上,出于安全性的要求便出现了oauth协议,2007年发布了Oauth1.0协议,2.0的草案与2011年发布. 1.2.0的用户授权过程(过程可参考流程图) 引导用户到授权服务器,请求用户授权,用户授权后返回 授权码(Authorization Code) 客户端由授权码到授权服务器换取访问令牌(Access Token) 用访问令牌去访问得到授权的资源 (Client指第三方应用,Resource Owner指用户,Authoriza

servlet3.0文件上传功能

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); //获取文件部件part Part part = request.getPart("file"); String h = part.getHeader(&

C# 8.0中的新功能

微信公众号:Fintech极客 作者为软件开发工程师,就职于金融信息科技类公司,通过CFA一级,分享计算机和金融相结合领域的技术和知识. C# 8.0中的新功能 C# 8.0已经推出来好长一段时间了, 由于公司目前主要使用的还是6.0版本,加上之前个人事情较多,一直没有总结,今天主要查看和测试微软官方文档中的内容:https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8 只读成员(Readonly members) 在st