Код: Выделить всё
var keysArray = [1,2]
keysArray.ForEach(key =>
{
//schedule will be unique for a key
var schedule = AppConfig.Get($"CronJobs.{key}.TimeSheetAutoSubmit.Schedule.QuarzExpression") ?? "0 30 23 * * ?";
var timeZoneId = AppConfig.Get($"CronJobs.{key}.TimeSheetAutoSubmit.TimeZoneId") ?? "India Standard Time";
var trigger = TriggerBuilder.Create()
.ForJob(jobDetail)
.WithCronSchedule(schedule, x => x
.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(timeZoneId)))
.WithIdentity($"TimeSheetAutoSubmitTrigger_{key}")
.WithDescription($"ConfigKey_{key}")
.StartNow()
.Build();
Scheduler.ScheduleJob(jobDetail, trigger);
});
Код: Выделить всё
2017-03-16 12:04:12,247 [DefaultQuartzScheduler_Worker-1] INFO UnitedLex.Services.JobHandlers.timesheetautosubmit - job started
2017-03-16 12:04:13,510 [DefaultQuartzScheduler_Worker-2] INFO UnitedLex.Services.JobHandlers.timesheetautosubmit - job started
2017-03-16 12:04:13,710 [DefaultQuartzScheduler_Worker-2] INFO UnitedLex.Services.JobHandlers.timesheetautosubmit - job started
Подробнее здесь: https://stackoverflow.com/questions/427 ... ce-c-sharp
Мобильная версия