views:

285

answers:

3

I would like to create a generic job class which takes some arguments instead of creating job class before hand?

All the settings are stored in a db so we could just call "refresh" which drops all the jobs and re-registers them from the database.

+2  A: 

You can specify arguments for your job in the JobExecutionContext, e.g. injected by spring.

bertolami
can you register multiple jobs per JobClass? Since it's generic, it will have multiple instances of it. It's basically for reports. So someone might schedule a report to be emailed every day and someone else might schedule it every week.
actually I am not sure. But you could configure two jobs with two triggers but use the same class. Just send different argument to the jobs.
bertolami
A: 

The "Spring Recipes" book has a very simple example for demonstrating using Quartz. I recommend taking a look.

harschware
A: 

You can reuse the logic (job) and parametrize it by using JobDataMap. You can have as many triggers and jobs as you want. Just remember the rule that one job can have many triggers but not vice versa.

Marko Lahma