Esempio n. 1
0
        public void ScheduleTask(Guid id, string cronExpression, Func <CancellationToken, Task> func)
        {
            var expression = _cronParser.Parse(cronExpression);

            var scheduledTask = new ScheduledTask(id, expression, func);

            _scheduledTasks.Add(scheduledTask);
        }
Esempio n. 2
0
        public void ChangeSchedule <T>(string cronString) where T : ICronJob
        {
            Stop();

            _cronExpression = _cronParser.Parse(cronString);

            Create <T>();
        }
Esempio n. 3
0
 public JobHandler(Guid jobId, ICronJob cronJob, string cronExpression, IServiceScopeFactory serviceScopeFactory)
 {
     JobId                = jobId;
     _cronJob             = cronJob;
     _serviceScopeFactory = serviceScopeFactory;
     _cronParser          = new CronParser(new CronDateTimeService());
     _cronExpression      = _cronParser.Parse(cronExpression);
 }