0
votes

I scheduled quartz jobs using the spring application context to run each night. Now I want to change the cron job for an already running application so it runs an hour later. We want to change the cron job in the application context and then restart the application for changes to take effect. We do not have acces to the database for security reasons.

I use a CronTriggerBean to run a jobDetail and also supply a cron expression. Now if I change the cron expression and restart the application it does not update the actual cron expression, because this is stored in the database.

How can I make sure the cron expression is updated each time I restart the application?

Edit: Quartz takes the cron expression from the application context and stores this internally in the database. Upon restarting the application with the new cron expression it does not update the value in the database and keeps using the old expression.

2

2 Answers

0
votes

Can you publish one JMX Service of Quartz Scheduler that allows to change this at run time more easy:

http://quartz-scheduler.org/api/2.2.0/org/quartz/core/jmx/QuartzSchedulerMBean.html

You can enable this functionality with this property (in your quartz.properties):

org.quartz.scheduler.jmx.export = true

And then you can open your jmxconsole for see the quartz jmx service.

Hope it helps.

0
votes

what i understand from your question, you might have below configuration in app context

<property name="cronExpression" value="${cron expression}" />

i.e you externalized your cron expression , in your case database. so you need to change in database to get effective, where else you have the cron expression configured?