public override void Schedule(JobDataMap jdm) { var sched = SF.GetScheduler(); var job = JobBuilder .Create <T>() .WithIdentity(_jobName, _jobGroupString) .SetJobData(jdm) .Build(); Logger.LogInformation($"Scheduling fixed time of day job {typeof(T)} to run every day at {_timeOfDay.TotalHours} hours past midnight system time"); var trigger = TriggerBuilder.Create() .WithIdentity($"{_jobGroupString}{_jobName}FixedTimeOfDay", _jobGroupString) .ForJob(_jobName, _jobGroupString) .StartAt(DateBuilder.FutureDate(30, IntervalUnit.Second)) .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(_timeOfDay.Hours, _timeOfDay.Minutes)) .Build(); sched.ScheduleJob(job, trigger); }
public override void Schedule(JobDataMap jdm) { var sched = SF.GetScheduler(); var job = JobBuilder .Create <T>() .WithIdentity(_jobName, _jobGroupString) .SetJobData(jdm) .Build(); Logger.LogInformation($"Scheduling recurring job {typeof(T)} to run once per {_period.TotalMinutes} minutes"); var trigger = TriggerBuilder.Create() .WithIdentity($"{_jobGroupString}{_jobName}Recurring", _jobGroupString) .ForJob(_jobName, _jobGroupString) .StartAt(DateBuilder.FutureDate(30, IntervalUnit.Second)) .WithSimpleSchedule(x => x .WithInterval(_period) .RepeatForever()) .Build(); sched.ScheduleJob(job, trigger); }