• 大小: 3.95M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-05-01
  • 语言: C#
  • 标签: Quartz  .NET  UART  NET  任务  

资源简介

移植Quartz.Net定时任务框架,实现可配置的执行定时任务

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz.Impl;
using Quartz;
using DispatchingService.CustomerJob;
using DispatchingService.CustomerListener;

namespace DispatchingService
{
    public class DispatchingManager
    {
        private static IScheduler scheduler;

        public async static Task Init()
        {
            try
            {
                //时间轴
                StdSchedulerFactory factory = new StdSchedulerFactory();    //工厂
                scheduler = await factory.GetScheduler();                   //创建任务调度

                #region SendMessageJob
                ////任务策略
                //IJobDetail jobDetail = JobBuilder.Create()
                //    .WithIdentity(“sendMessageJob“ “group1“)   //分组
                //    .WithDescription(“这是一个sendMessage任务“)   //任务描述
                //    .Build();

                ////传递参数
                //jobDetail.JobDataMap.Add(“student1“ “张三“); //传入键值
                //jobDetail.JobDataMap.Add(“student2“ “李四“);
                //jobDetail.JobDataMap.Add(“student3“ “王五“);
                //jobDetail.JobDataMap.Add(“year“ DateTime.Now.Year);
                //jobDetail.JobDataMap.Add(“count“ 100);

                ////时间策略
                //ITrigger trigger = TriggerBuilder.Create()
                //    .WithIdentity(“sendMessageTrigger“ “group1“)           //分组
                //    .StartNow()                                             //立即执行一次,不是必须的(默认)
                //                                                            //.WithSimpleSchedule(w => w.WithIntervalInSeconds(5).WithRepeatCount(10))    //每5秒执行一次,总共执行10次(不包括startnow这一次)
                //    .WithSimpleSchedule(w => w.WithIntervalInSeconds(5).RepeatForever())          //一直执行    
                //    .Build();

                ////传递参数
                //trigger.JobDataMap.Add(“student4“ “赵六“);
                //trigger.JobDataMap.Add(“student5“ “田七“);
                //trigger.JobDataMap.Add(“student6“ “刘八“);
                //trigger.JobDataMap.Add(“year“ DateTime.Now.Year + 1);

                ////关联
                //await scheduler.ScheduleJob(jobDetail trigger);
                #endregion

                #region SayHellowJob
                //任务策略
                IJobDetail jobDetail = JobBuilder.Create()
                    .WithIdentity(“sayHelloJob“ “group2“)     //分组
                    .WithDescription(“这是一个sayHello任务“)      //任务描述
                    .Build();

                //时间策略
                ITrigger trigger = TriggerBuilder.Create()
                    .WithIdentity(“sayHelloTrigger“ “group2“)              //分组
                                                                            //.StartAt(new DateTimeOffset())                        //从某个时间点开始执行
                    .WithSimpleSchedule(w => w.Wi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     82944  2020-11-01 23:42  Quartz.Net定时任务框架\.vs\test1\v14\.suo

     文件      20480  2020-11-01 23:11  Quartz.Net定时任务框架\DispatchingService\bin\Debug\DispatchingService.dll

     文件      46592  2020-11-01 23:11  Quartz.Net定时任务框架\DispatchingService\bin\Debug\DispatchingService.pdb

     文件     866816  2018-10-07 12:27  Quartz.Net定时任务框架\DispatchingService\bin\Debug\Quartz.dll

     文件     225172  2018-10-07 12:27  Quartz.Net定时任务框架\DispatchingService\bin\Debug\Quartz.pdb

     文件    1040642  2018-10-07 12:27  Quartz.Net定时任务框架\DispatchingService\bin\Debug\Quartz.xml

     文件        649  2020-11-01 21:49  Quartz.Net定时任务框架\DispatchingService\CustomerJob\SayHelloJob.cs

     文件       2882  2020-11-01 21:42  Quartz.Net定时任务框架\DispatchingService\CustomerJob\SendMessageJob.cs

     文件       1430  2020-11-01 22:43  Quartz.Net定时任务框架\DispatchingService\CustomerListener\CustomerJobListener.cs

     文件       4448  2020-11-01 22:54  Quartz.Net定时任务框架\DispatchingService\CustomerListener\CustomerSchedulerListener.cs

     文件       1940  2020-11-01 22:47  Quartz.Net定时任务框架\DispatchingService\CustomerListener\CustomerTriggerListener.cs

     文件       4656  2020-11-01 23:18  Quartz.Net定时任务框架\DispatchingService\DispatchingManager.cs

     文件       3265  2020-11-01 22:49  Quartz.Net定时任务框架\DispatchingService\DispatchingService.csproj

     文件       7094  2020-11-01 22:48  Quartz.Net定时任务框架\DispatchingService\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        669  2020-11-01 22:00  Quartz.Net定时任务框架\DispatchingService\obj\Debug\DispatchingService.csproj.FileListAbsolute.txt

     文件      12385  2020-11-01 22:00  Quartz.Net定时任务框架\DispatchingService\obj\Debug\DispatchingService.csprojResolveAssemblyReference.cache

     文件      20480  2020-11-01 23:11  Quartz.Net定时任务框架\DispatchingService\obj\Debug\DispatchingService.dll

     文件      46592  2020-11-01 23:11  Quartz.Net定时任务框架\DispatchingService\obj\Debug\DispatchingService.pdb

     文件          0  2020-11-01 20:25  Quartz.Net定时任务框架\DispatchingService\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2020-11-01 20:25  Quartz.Net定时任务框架\DispatchingService\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2020-11-01 20:25  Quartz.Net定时任务框架\DispatchingService\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        134  2020-11-01 20:31  Quartz.Net定时任务框架\DispatchingService\packages.config

     文件       1344  2020-11-01 20:25  Quartz.Net定时任务框架\DispatchingService\Properties\AssemblyInfo.cs

     文件       9461  2018-10-07 05:31  Quartz.Net定时任务框架\packages\Quartz.3.0.7\.signature.p7s

     文件     866816  2018-10-07 12:27  Quartz.Net定时任务框架\packages\Quartz.3.0.7\lib\net452\Quartz.dll

     文件     225172  2018-10-07 12:27  Quartz.Net定时任务框架\packages\Quartz.3.0.7\lib\net452\Quartz.pdb

     文件    1040642  2018-10-07 12:27  Quartz.Net定时任务框架\packages\Quartz.3.0.7\lib\net452\Quartz.xml

     文件     862208  2018-10-07 12:27  Quartz.Net定时任务框架\packages\Quartz.3.0.7\lib\netstandard2.0\Quartz.dll

     文件     223688  2018-10-07 12:27  Quartz.Net定时任务框架\packages\Quartz.3.0.7\lib\netstandard2.0\Quartz.pdb

     文件    1037750  2018-10-07 12:27  Quartz.Net定时任务框架\packages\Quartz.3.0.7\lib\netstandard2.0\Quartz.xml

............此处省略56个文件信息

评论

共有 条评论