A robust implementation with ADOJobStore is to create a custom table for storing tasks and create a class that inherits from ISchedulerPlugin and IJob to automatically create schedules for your work.
Your configuration will look like this:
<add key="quartz.plugin.sqlquartzjobs.type" value="(JobSchedulerPlugin assembly path)" />
<add key="quartz.plugin.sqlquartzjobs.RescanCronExpression" value="0 0/5 * * * ?" />
<add key="quartz.plugin.sqlquartzjobs.ConnectionString" value="(your connection string)" />
Your plugin / task class might look like this:
public class JobSchedulerPlugin : ISchedulerPlugin, IJob
{
public void Initialize(string pluginName, IScheduler sched)
{
Name = pluginName;
Scheduler = sched;
}
public void Start()
{
JobDataMap jobData = new JobDataMap();
jobData["ConnectionString"] = ConnectionString;
IJobDetail job = JobBuilder.Create(this.GetType())
.WithDescription("Job to rescan jobs from SQL db")
.WithIdentity(new JobKey(JobInitializationPluginJobName, JobInitializationPluginGroup))
.UsingJobData(jobData)
.Build();
TriggerKey triggerKey = new TriggerKey(JobInitializationPluginJobTriggerName, JobInitializationPluginGroup);
ITrigger trigger = TriggerBuilder.Create()
.WithCronSchedule(ConfigFileCronExpression)
.StartNow()
.WithDescription("trigger for sql job loader")
.WithIdentity(triggerKey)
.WithPriority(1)
.Build();
Scheduler.ScheduleJob(job, trigger);
}
}
JobSchedulerPlugin QRTZ_TRIGGERS, . ( QUARTZJOBS). QUARTZJOBS , , , , .., , . cron . , , :
public void Execute(IJobExecutionContext context)
{
Scheduler = context.Scheduler;
JobCollection jobs = LoadJobs(context.JobDetail.JobDataMap["ConnectionString"].ToString());
JobsWithTriggers jobTriggers = CreateTriggers(jobs);
SchedulerJob(jobTriggers);
}
protected JobCollection LoadJobs(string connectionString);
protected JobsWithTriggers CreateTriggers(jobs);
protected void ScheduleJobs(jobstriggers)
, , , cron .
. plugin/job .