c# - Scheduling Dependent Jobs in Quartz.Net -


i need help. trying figure out how schedule jobs in quartz.net. jobs in quartz correspond tasks in web application, each apart of job in web application. want users able launch job (webapplication context) on demand , have run or schedule job in future and, possibly repeat on given interval. know how these items accomplished in quartz individually, having hard time putting together.

for example, in web application, may have job several task, in specific order. want able schedule these tasks in quartz execute in same order determined in web application. have idea of how this? have read on quartz documentation saying store next job in jobdatamap, struggling it.

i waiting create quartz jobs until user requests either schedule job or run it. think should creating job , trigger on creation of task in web app , pulling information task object scheduling in quartz?

on second paragraph: if understand correctly, have set of jobs, user can select , put in order of execution. approach creating job instance of every job type selected user. in order persist order of jobs, can store groupname , jobname of next job in jobdatamap of previous job. can have generic joblistener, registered jobs. listener notified when job executed , passed job bundle argument. joblistener can enumerate jobdatamap of job has been executed. if finds key-value pair key "nextjobname", joblistener query scheduler job. reference scheduler of available in job bundle. if scheduler returns instance of jobdetail given name, joblistener execute it, notified when completes , on until gets job "nextjobname" in jobdatamap.
alternatively, if don't want have job listeners, can have base job class implements functionality.all jobs derive class , override virtual execute method. can call base.execute(context) before overriding implementation returns.

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")); // fire job         }     } }  public class myjob : basejob {     public override void execute(jobexecutioncontext context)     {         //do work         base.execute(context);     } } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -