开发者

Grails unschedule a quartz job

开发者 https://www.devze.com 2023-01-31 17:28 出处:网络
I have a requirement to schedule and unschedule a quartz job programmatically. I was able to schedule it using MyJob.schedule(cronExpression). Is there a way to similarl开发者_如何转开发y unschedule t

I have a requirement to schedule and unschedule a quartz job programmatically. I was able to schedule it using MyJob.schedule(cronExpression). Is there a way to similarl开发者_如何转开发y unschedule the job?

I am using quartz plugin 0.4.2 with Grails 1.2.3


removeJob() removes the job altogether and it cannot be scheduled again programmatically with MyJob.schedule(Trigger)

Here is what worked for me,

quartzScheduler.unscheduleJob("TriggerName", "TriggerGroup")
//TriggerName and TriggerGroup are the name and group of the Trigger used for schedule


QuartzGrailsPlugin.groovy says it's removeJob().


Running version 1.0.1

See this http://jira.grails.org/browse/GPQUARTZ-132#comment-78800

The trigger name by default on the MyJob.schedule() is screwy hardceoded UUID "GRAILS_586eb149-83f7-486c-88fc-e44a5bb0541" & a static group value of "GRAILS_TRIGGERS"

Either A: lookup your triggerName by the cronvalue (assuming it's unique) B: don't use the simple MyJob.schedule( trig) simple coolness provided by grails plugin.

0

精彩评论

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