MeanwhileInHell
MeanwhileInHell

Reputation: 7053

Scheduling a job to begin after a Job fired by CronTrigger completes using Quartz

I was wondering if it was possible to schedule a job to start after a job fired by a CronTrigger successfully completes, using Quartz in Java?

Upvotes: 1

Views: 1243

Answers (1)

extraneon
extraneon

Reputation: 23950

From the feature Documentation:

As Jobs are completed, they return a JobCompletionCode which informs the scheduler of success or failure. The JobCompletionCode can also instruct the scheduler of any actions it should take based on the success/fail code - such as immediate re-execution of the Job.

I think the JobChainingJobListener should be interesting:

Keeps a collection of mappings of which Job to trigger after the completion of a given job.

This is assuming you use the CronJob from quartz of course.

Otherwise you'd need to program (in java) some kind of socket listener, and wrap the cron job in a script which, at the end, triggers Java by writing something on the socket (or pipe, or web service call, whatever you like). Your java code would then trigger the quartz job.

Upvotes: 2

Related Questions