开发者

Editting jobs CronExpression programatically in Quartz.NET - what methods?

what methods are there for a CronTrigger to modify i开发者_开发百科ts 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜