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