Grails-Plugin-Consortium / grails-jesque

1 stars 5 forks source link

programmatically scheduling a recurring task silently fails #24

Open edwardotis opened 7 years ago

edwardotis commented 7 years ago

The static trigger inside a class with a quartz cron expression works. However, this has the down side that every time a server reboots, it restarts the cronjob. This is not acceptable behavior in many applications. We need to be able to programmatically start and stop recurring tasks at runtime.

Removing a recurring task works programatically. (Though it does throw multiple exceptions.) jesqueSchedulerService.deleteSchedule("MyDemoJesqueJobTrigger")

However, the jesqueSchedulerService#schedule functionality silently fails to add the same recurring job that works from static triggers. jesqueSchedulerService.schedule("MyDemoJesqueJobTrigger, "0/5 ?", Constants.JESQUE_CRONJOB_QUEUE_NAME, TestRecurringJob.simpleName, [])

This scheduling behavior works correct in jesque. https://github.com/gresrun/jesque#recurring-jobs

Jesque lacks the quartz cron expressions support that grails jesque has. The quartz cron expression is much better for many use cases than setting the milliseconds between job executions.

v1.2.1 plugin 3.1.16 grails

bp-FLN commented 5 years ago

not sure if adding support for recurring jobs is the right thing to do, as a trigger provides the same behaviour

However, this has the down side that every time a server reboots, it restarts the cronjob.

what exactly do you mean with "restarts the cronjob"? what issue does it cause for you?