Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>On the second paragraph: If I understand you correctly, you have a set of jobs, from which the user can select and put in certain order of execution. I would approach it by creating a job instance of every job type selected by the user. In order to persist the order of the jobs, you can store the groupname and jobname of the next job in the JobDataMap of the previous job. Then you can have a generic JobListener, which is registered with all jobs. The listener will get notified when a job is executed and will be passed the job bundle as an argument. The JobListener can enumerate the JobDataMap of the job which has just been executed. If it finds a key-value pair with key "nextjobname", the JobListener will query the scheduler for this job. A reference to the scheduler of also available in the job bundle. If the scheduler returns an instance of JobDetail for the given name, the JobListener will execute it, will get notified when it completes and so on until it gets to a job with "nextjobname" in the JobDataMap.<br /> Alternatively, if you don't want to have Job Listeners, you can have a base Job class which implements this functionality.All your jobs will derive from this class and will override its virtual Execute method. You can call base.Execute(context) just before the overriding implementation returns. </p> <pre><code>public class Basejob : IJob { public virtual void Execute(JobExecutionContext context) { string nextJob = context.MergedJobDataMap["nextjobname"]; JobDetail nextjob = context.Scheduler.GetJobDetail(context.MergedJobDataMap["nextjobname"], context.MergedJobDataMap["nextjobgroupname"]); if(nextjob != null) { context.Scheduler.ScheduleJob(nextjob, new SimpleTrigger(nextjob.Name + "trigger")); // this will fire the job immediately } } } public class MyJob : BaseJob { public override void Execute(JobExecutionContext context) { //do work base.Execute(context); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload