public void AddTask(string taskName, string cronConfig, Action action)
        {
            // get a scheduler
            _sched = schedFact.GetScheduler();

            // construct job info
            var task = new CronTask(taskName, cronConfig, action);

            var jobDetail = new JobDetailImpl(task.TaskName, typeof (CronTask));
            jobDetail.JobDataMap.Put("task", task);

            // fire every hour
            var trigger = new CronTriggerImpl(task.TaskName, "Group1", task.CronConfig);

            _sched.ScheduleJob(jobDetail, trigger);
        }
Beispiel #2
0
        public void AddTask(string taskName, string cronConfig, Action action)
        {
            // get a scheduler
            _sched = _factory.GetScheduler().Result;

            // construct job info
            var task = new CronTask(taskName, cronConfig, action);


            var jobDetail = new JobDetailImpl(task.TaskName, typeof(CronTask));

            jobDetail.JobDataMap.Put("task", task);

            // fire every hour
            var trigger = new CronTriggerImpl(task.TaskName, "Group1", task.CronConfig);

            _sched.ScheduleJob(jobDetail, trigger);
        }