标签:now() seconds actor pack rgs lin syn oid async
using Quartz; using Quartz.Impl; using System; using System.Threading.Tasks; namespace WorkSample.Quartz { class Program { static void Main(string[] args) { ScheduleJobs().GetAwaiter().GetResult(); } private static async Task ScheduleJobs() { var scheduler = await new StdSchedulerFactory().GetScheduler(); await scheduler.Start(); await scheduler.ScheduleJob( JobBuilder.Create<FirstJob>().Build(), TriggerBuilder.Create().StartNow().WithCronSchedule("0/1 * * * * ? *").Build() // http://cron.qqe2.com/ ); await scheduler.ScheduleJob( JobBuilder.Create<SecondJob>().Build(), TriggerBuilder.Create().StartNow().WithCronSchedule("0/1 * * * * ? *").Build() ); await Task.Delay(TimeSpan.FromSeconds(60)); await scheduler.Shutdown(); } } public class FirstJob : IJob { public async Task Execute(IJobExecutionContext context) { await Console.Out.WriteLineAsync("FirstJob Execute"); } } public class SecondJob : IJob { public async Task Execute(IJobExecutionContext context) { await Console.Out.WriteLineAsync("SecondJob Execute"); } } } // Install-Package Quartz // https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/index.html
标签:now() seconds actor pack rgs lin syn oid async
原文地址:https://www.cnblogs.com/xiaowangzhi/p/11441412.html