Esempio n. 1
0
 private static ITrigger CreateTrigger(JobSchedule schedule)
 {
     return(TriggerBuilder
            .Create()
            .WithIdentity($"{schedule.JobType.FullName}.trigger")
            .WithCronSchedule(schedule.CronExpression)
            .WithDescription(schedule.CronExpression)
            .Build());
 }
Esempio n. 2
0
        private static IJobDetail CreateJob(JobSchedule schedule)
        {
            var jobType = schedule.JobType;

            return(JobBuilder
                   .Create(jobType)
                   .WithIdentity(jobType.FullName)
                   .WithDescription(jobType.Name)
                   .Build());
        }
Esempio n. 3
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            var jobSchedule = new JobSchedule(jobType: typeof(AlertJob), cronExpression: "0 0/5 * * * ?");

            var job     = CreateJob(jobSchedule);
            var trigger = CreateTrigger(jobSchedule);

            await _scheduler.ScheduleJob(job, trigger, cancellationToken);

            //await _scheduler.Start(cancellationToken);
        }