ams
ams

Reputation: 62642

How to make a quartz job create another job to execute after it?

I am tying to implement the following algorithm with Quartz and not really sure if it can be done. This is my first attempt at using quartz.

Monthly Job to figure who needs reports Fires

  1. search the database to look for users that need to be sent a monthly report
  2. for each user found create a jobDetail that will compute the monthly report and deliver it to report sender that takes care of sending the report
  3. schedule each of the jobDetails from step 2 to execute right after this job finishes

What I have not been able to figure out.

  1. How to make sure that monthly job executes in a single transaction so that all users that need a monthly report are identified and jobs are scheduled to notify them
  2. How to schedule a job right away to execute right after the job that created them?

I am using Spring 3.2 an Quartz 2.1

Upvotes: 1

Views: 1774

Answers (1)

Shailesh Pratapwar
Shailesh Pratapwar

Reputation: 4224

Nice use case for quartz usage. You can try sheduling a new job from within the job class. This can be possibly with by creating a new jobdetail and trigger from inside execute() method.

Upvotes: 1

Related Questions