I'm actually working in Grails 3.x and I need to use Quartz Cron expressions. I've implemented successfully regular cron expression and works correctly, but now what I need to do is User (from a GUI) change that cron expression for any other he/she wants.
This is my Job
class ScheduleJob
{
static triggers =
{
cron name: 'myTrigger', cronExpression: "*/5 * * * * ?"
}
def execute()
{
println "------ Every 5 seconds"
}
}
I would appreciate so much if someone could help me to know how to do that, thanks for your time. :D
You have a number of options. One thing you can do is call
ScheduleJob.schedule(' your cron expression goes here ').You could also go get the job manager bean from the application context and reconfigure job beans there.
Some of the info at http://www.tothenew.com/blog/removing-triggers-and-rescheduling-a-quartz-2-job-programatically/ might be helpful.