[英]How to set a cron expression of cron job from controller in Grails
I want to get a cron expression from a user through .gsp and want to set it as new cron expression of Dynamic Job from controller. 我想通过.gsp从用户那里获得cron表达式,并希望将其设置为控制器中Dynamic Job的新cron表达式。 Intially my cron expression was like "0 1 0 * * ?" 最初,我的cron表达式就像“ 0 1 0 * *?” but now want to change it to.. say 但现在想将其更改为..说
String cronExpression="0 2 0 * * ?" // in the controller
// creates cron trigger;
DynamicJob.schedule(String cronExpression, Map params?)
but it doesn't work. 但这不起作用。
Something like this maybe: 可能是这样的:
trigger.cronExpression = params.cronexpression
quartzScheduler.rescheduleJob(new TriggerKey(params.triggerName, params.triggerGroup), trigger)
For more context see this controller in Quartz Monitor plugin or just use the plugin itself . 有关更多上下文,请参见Quartz Monitor插件中的此控制器,或仅使用插件本身 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.