Wednesday, November 2, 2011

grails quartz plugin - don't repeat jobs

well it might be obvious, but sometimes you just want to execute a simple job once during the startup and than let them be.

For an example I needed this to synchronize a database and run statistics over it. So the simples trigger I could come up with, was

static triggers = {
simple name: 'synchronize', startDelay: 60000, repeatCount: 0

An alternative way could had been todo schedule the job during the startup phase

SynchronizeExperimentJob.triggerNow([experimentId: id, database: database])

this line should be put into your bootstrapping file.

Personally I feel the trigger is more elegant.

No comments:

Post a Comment