开发者

Quartz.Net and passing data between chaining jobs

I've got to implement a simple workflow.

Some job A have to run at specified time (cron trigger). This job searches for unprocessed data (let's say some IThingToDo[]) and process it. Job B has to be performed just after job A finished and the list of processed data (IThingToDo[]) should be passed to it.

Job A stores data like this:

context.Put("Things", things);

Then I use IJobListener to know when job A finished, get the "Things" array and create a trigger for job B:

Trigger trigger = new SimpleTrigger("JobBTrigger", "NS", DateTime.Now);
trigger.JobName = "JobB";
trigger.JobGroup = "NS";
trigger.JobDataMap.Put("Things", things);
context.Scheduler.ScheduleJob(开发者_Go百科trigger);

This works fine. Except that I can't get "Things" from job B, context.Get("Things") == null.

What's wrong?


I've found an answer. I just had to use MergedJobDataMap (which is a combined JobDataMap from a JobDetail AND a Trigger):

var things = context.MergedJobDataMap.Get("Things");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜