详解免费开源的DotNet任务调度组件Quartz.NET(.NE(4)

/// <summary> /// 任务实体 /// </summary> public class TaskModel { /// <summary> /// 任务ID /// </summary> public Guid TaskID { get; set; } /// <summary> /// 任务名称 /// </summary> public string TaskName { get; set; } /// <summary> /// 任务执行参数 /// </summary> public string TaskParam { get; set; } /// <summary> /// 运行频率设置 /// </summary> public string CronExpressionString { get; set; } /// <summary> /// 任务运频率中文说明 /// </summary> public string CronRemark { get; set; } /// <summary> /// 任务所在DLL对应的程序集名称 /// </summary> public string AssemblyName { get; set; } /// <summary> /// 任务所在类 /// </summary> public string ClassName { get; set; } public TaskStatus Status { get; set; } /// <summary> /// 任务创建时间 /// </summary> public DateTime? CreatedTime { get; set; } /// <summary> /// 任务修改时间 /// </summary> public DateTime? ModifyTime { get; set; } /// <summary> /// 任务最近运行时间 /// </summary> public DateTime? RecentRunTime { get; set; } /// <summary> /// 任务下次运行时间 /// </summary> public DateTime? NextFireTime { get; set; } /// <summary> /// 任务备注 /// </summary> public string Remark { get; set; } /// <summary> /// 是否删除 /// </summary> public int IsDelete { get; set; } }

4.配置文件:

# You can configure your scheduler in either <quartz> configuration section # or in quartz properties file # Configuration section has precedence quartz.scheduler.instanceName = ExampleQuartzScheduler # 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

四.总结:

在项目中比较多的使用到定时任务的功能,今天的介绍的组件可以很好的完成一些定时任务的要求。这篇文章主要是作为引子,简单的介绍了组件的背景和组件的使用方式,如果项目中需要使用,可以进行更加深入的了解。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjyydy.html