Question

what methods are there for a CronTrigger to modify its CronExpression? I've tried to set it in the CronExpressionString but that doesn't seem to update it, and I can't convert my string to a CronExpression to use in the CronExpression method.

Was it helpful?

Solution

There really is no way to modify a trigger's cron expression through the API. The "normal" way to do what you want is to create a new trigger with the new cron expression and then either reschedule the job with the new trigger or delete and create the job with the new trigger.

If you're using a database as your job store, the cron expression is stored in the CRON_EXPRESSION column of the QRTZ_CRON_TRIGGERS table. Changing it directly in the database is probably not the best option but you could give it a try and see what happens.

OTHER TIPS

You would load the job to a local variable using GetJobDetail().
Then UnscheduleJob()
Finally, you'd create a new CronTrigger and call ScheduleJob().

-- Edit --
It has come to may attention that an easier way is Create a new trigger (of any type) and call RescheduleJob() using the same trigger name and group.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top