static void Main(string[] args) { Task<IScheduler> tsk=StdSchedulerFactory.GetDefaultScheduler(); IScheduler Scheduler = tsk.Result; IJobDetail JobDetail = JobBuilder.Create<Job>().WithIdentity("完成").Build(); ITrigger trigger = TriggerBuilder.Create().WithIdentity("确认定时") .WithCronSchedule("0/5 * * * * ?").Build() as ITrigger; //每5s一次 Scheduler.ScheduleJob(JobDetail, trigger); Scheduler.Start(); Console.ReadKey(); }
public class Job : IJob { public async Task Execute(IJobExecutionContext context) { await Task.Run(() => { Console.WriteLine("123"); }); } }
标签:Task,Console,Create,ITrigger,job,Quartz,Scheduler,定时 From: https://www.cnblogs.com/daimaxuejia/p/18028664