Quartz.NET 2.0 学习笔记(2) :和1.0的几点不同
2015-08-23 10:18
405 查看
Quartz.NET 2.0 2012年4月9日发布了Released
Quartz.NET 项目地址 http://quartznet.sourceforge.net/
Quartz.NET
2.0 学习笔记(1) :Quartz.NET简介
Quartz.NET
2.0 学习笔记(2) :和1.0的几点不同
Quartz.NET
2.0 学习笔记(3) :通过配置文件实现任务调度
Quartz.NET
2.0 学习笔记(4) :cron表达式
Quartz.NET
2.0 学习笔记(5) :实例创建Windows服务实现任务调度
日常开发来说,相对于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
[plain]
view plaincopyprint?
# You can configure your scheduler in either <quartz> configuration section
# or in quartz properties file
# Configuration section has precedence
quartz.scheduler.instanceName = ServerScheduler
# configure thread pool info
quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
quartz.threadPool.threadCount = 10
quartz.threadPool.threadPriority = Normal
# job initialization plugin handles our xml reading, without it defaults are used -->
quartz.plugin.xml.type = Quartz.Plugin.Xml.JobInitializationPlugin, Quartz
quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
# export this server to remoting context
quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
quartz.scheduler.exporter.port = 555
quartz.scheduler.exporter.bindName = QuartzScheduler
quartz.scheduler.exporter.channelType = tcp
2.0 quartz.config
[plain]
view plaincopyprint?
# You can configure your scheduler in either <quartz> configuration section
# or in quartz properties file
# Configuration section has precedence
quartz.scheduler.instanceName = ServerScheduler
# configure thread pool info
quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
quartz.threadPool.threadCount = 10
quartz.threadPool.threadPriority = Normal
# job initialization plugin handles our xml reading, without it defaults are used
quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
# export this server to remoting context
quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
quartz.scheduler.exporter.port = 555
quartz.scheduler.exporter.bindName = QuartzScheduler
quartz.scheduler.exporter.channelType = tcp
quartz.scheduler.exporter.channelName = httpQuartz
变化三 实现IJob接口 JobExecutionContext对象变成了IJobExecutionContext
1.0 IJob接口
[csharp]
view plaincopyprint?
public class SimpleJob : IJob
{
#region IJob 成员
public void Execute(JobExecutionContext context)
{
throw new NotImplementedException();
}
#endregion
}
2.0 IJob接口
[csharp]
view plaincopyprint?
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示例
[html]
view plaincopyprint?
<?xml version="1.0" encoding="UTF-8"?>
<quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" overwrite-existing-jobs="true">
<job>
<job-detail>
<name>sampleJob</name>
<group>sampleGroup</group>
<description>Sample job for Quartz Server</description>
<job-type>Quartz.Job.NoOpJob, Quartz</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
</job-detail>
<trigger>
<simple>
<name>sampleSimpleTrigger</name>
<group>sampleSimpleGroup</group>
<description>Simple trigger to simply fire sample job</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>sampleJob</job-name>
<job-group>sampleGroup</job-group>
<repeat-count>RepeatIndefinitely</repeat-count>
<repeat-interval>3000</repeat-interval>
</simple>
</trigger>
</job>
<job>
<job-detail>
<name>sampleJob2</name>
<group>sampleGroup2</group>
<description>Sample job for Quartz Server</description>
<job-type>Quartz.Job.NoOpJob, Quartz</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
</job-detail>
<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>
</job>
</quartz>
2.0 quartz_jobs.xml示例
[html]
view plaincopyprint?
<?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.NET 项目地址 http://quartznet.sourceforge.net/
Quartz.NET
2.0 学习笔记(1) :Quartz.NET简介
Quartz.NET
2.0 学习笔记(2) :和1.0的几点不同
Quartz.NET
2.0 学习笔记(3) :通过配置文件实现任务调度
Quartz.NET
2.0 学习笔记(4) :cron表达式
Quartz.NET
2.0 学习笔记(5) :实例创建Windows服务实现任务调度
日常开发来说,相对于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
[plain]
view plaincopyprint?
# You can configure your scheduler in either <quartz> configuration section
# or in quartz properties file
# Configuration section has precedence
quartz.scheduler.instanceName = ServerScheduler
# configure thread pool info
quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
quartz.threadPool.threadCount = 10
quartz.threadPool.threadPriority = Normal
# job initialization plugin handles our xml reading, without it defaults are used -->
quartz.plugin.xml.type = Quartz.Plugin.Xml.JobInitializationPlugin, Quartz
quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
# export this server to remoting context
quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
quartz.scheduler.exporter.port = 555
quartz.scheduler.exporter.bindName = QuartzScheduler
quartz.scheduler.exporter.channelType = tcp
2.0 quartz.config
[plain]
view plaincopyprint?
# You can configure your scheduler in either <quartz> configuration section
# or in quartz properties file
# Configuration section has precedence
quartz.scheduler.instanceName = ServerScheduler
# configure thread pool info
quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
quartz.threadPool.threadCount = 10
quartz.threadPool.threadPriority = Normal
# job initialization plugin handles our xml reading, without it defaults are used
quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
# export this server to remoting context
quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
quartz.scheduler.exporter.port = 555
quartz.scheduler.exporter.bindName = QuartzScheduler
quartz.scheduler.exporter.channelType = tcp
quartz.scheduler.exporter.channelName = httpQuartz
变化三 实现IJob接口 JobExecutionContext对象变成了IJobExecutionContext
1.0 IJob接口
[csharp]
view plaincopyprint?
public class SimpleJob : IJob
{
#region IJob 成员
public void Execute(JobExecutionContext context)
{
throw new NotImplementedException();
}
#endregion
}
2.0 IJob接口
[csharp]
view plaincopyprint?
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示例
[html]
view plaincopyprint?
<?xml version="1.0" encoding="UTF-8"?>
<quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" overwrite-existing-jobs="true">
<job>
<job-detail>
<name>sampleJob</name>
<group>sampleGroup</group>
<description>Sample job for Quartz Server</description>
<job-type>Quartz.Job.NoOpJob, Quartz</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
</job-detail>
<trigger>
<simple>
<name>sampleSimpleTrigger</name>
<group>sampleSimpleGroup</group>
<description>Simple trigger to simply fire sample job</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>sampleJob</job-name>
<job-group>sampleGroup</job-group>
<repeat-count>RepeatIndefinitely</repeat-count>
<repeat-interval>3000</repeat-interval>
</simple>
</trigger>
</job>
<job>
<job-detail>
<name>sampleJob2</name>
<group>sampleGroup2</group>
<description>Sample job for Quartz Server</description>
<job-type>Quartz.Job.NoOpJob, Quartz</job-type>
<volatile>false</volatile>
<durable>true</durable>
<recover>false</recover>
</job-detail>
<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>
</job>
</quartz>
2.0 quartz_jobs.xml示例
[html]
view plaincopyprint?
<?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的支持
相关文章推荐
- Java编程Tips
- 计算机网络信息服务系统的安装与配置(二)
- LINGO的NLP问题
- python redis
- UEditor-分布式部署解决方案
- 暑期留校之iOS学习笔记
- Opencv定义输出vector容器的point类型的点
- Quartz.NET 2.0 学习笔记(1) :Quartz.NET简介
- 选择器和Class
- 【设计模式】发送生成的组合模式
- 暑期留校iOS学习笔记
- 在jsp中,获取页面中中文输入的值乱码问题解决。修改tomcat的编码问题
- mac 下安装php5.6 with php-fpm
- Opencv定义和输出基于Mat的vector
- 10 Easy Ways To Protect Your Eyes From The Harms of Digital Devices
- OC的动态继承编译机制
- 暑期留校iOS学习笔记
- 社説 20150823 露首相択捉訪問 領土交渉に背向ける軽挙妄動
- 剑指off-成员变量初始化
- 一个人的精神结构和他的精神资源