Armen Arzumanyan
Armen Arzumanyan

Reputation: 2043

How to save Quartz executed jobs?

One problem, after executed jobs, quartz delete jobs from database qrtz_triggers table, but in specific situation needed to repeat job which is failed.

Is any configuration options or way to store jobs to another table after execute???

Thanks

Upvotes: 3

Views: 8917

Answers (2)

Daniel
Daniel

Reputation: 1696

If you are using JDBCJobStore, your jobs are stored in a table like QRTZ_JOB_DETAILS, and your simple triggers are stored in QRTZ_SIMPLE_TRIGGERS, your cron trigers are stored in QRTZ_CRON_TRIGGERS, and all the triggers are stored in QRTZ_TRIGGERS.

If you expect your job is durable and remains when no triggers are associated to the job, you should call storeDurably(true) when building your JobDetail. For example:

JobDetail jobDetail = JobBuilder.newJob()
    .ofType(DataMapJob.class)
    .withIdentity("dataJob", "dataJobGroup")
    .storeDurably(true)
    .requestRecovery(true)
    .build();

Hope it helps.

Upvotes: 9

Jan Moravec
Jan Moravec

Reputation: 1880

This is exactly what the durable flag is for. Durable jobs remain registered in Quartz even if there are no triggers associated with the job. On the other hand, non-durable jobs are automatically deleted by Quartz where there are no associated triggers (e.g. after all associated triggers fired and have been deleted by Quartz).

For details, you can refer to JobDetailImpl javadoc.

Upvotes: 3

Related Questions