1
votes

Is there any way to persist JobDataMap without triggering/scheduling any jobs? Can I afterwards (on callback) start a Job with the stored JobDataMap?

I have many jobs scheduled with Quartz an I pass JobDataMap to those jobs:

scheduler.triggerJob(new JobKey("job-name", "job-group"), myJobDataMap);

Now I need to implement job queue since there are jobs which can't be launched in parallel. The problem is that state (JobDataMap) for some jobs is passed from client, and should be persisted for queueing purposes. In other hand I can't schedule job on user request since I don't know when it should be executed! (It should be executed right after previous job)

1

1 Answers

1
votes

Yes.

You can use the method addJob(JobDetail, boolean) to add a new job to the Scheduler without actually scheduling it. Quoting the docs:

The Job will be 'dormant' until it is scheduled with a Trigger, or Scheduler.triggerJob() is called for it.

Your data map would be part of the JobDetail parameter.