| commit | 6bf3595e2fc3c7167116f47107ed303b908eddd8 | [log] [tgz] |
|---|---|---|
| author | Ryan Vanderwerf <vanderwerfr@ociweb.com> | Fri Feb 26 17:47:37 2016 -0600 |
| committer | Ryan Vanderwerf <vanderwerfr@ociweb.com> | Fri Feb 26 17:47:37 2016 -0600 |
| tree | 6b4d990b744bdc34fd3db04bfe9a4bde11639622 | |
| parent | d77f6b310f9ad75c76286b367f14e047dde49691 [diff] |
#63 build deploy issues
Latest documentation and snapshots are available.
The current master branch is for 2.x versions of the plugin compatible with Grails 3. There is a 1.x branch for on-going maintenance of 1.x versions of the plugin compatible with Grails 2. Please submit any pull requests to the appropriate branch. Changes to the 1.x branch will be merged into the master branch if appropriate.
To start using Quartz plugin just simply add compile 'org.grails.plugins:quartz:2.0.1' in your build.gradle.
To create a new job run the grails create-job command and enter the name of the job. Grails will create a new job and place it in the grails-app/jobs directory:
package com.mycompany.myapp
class MyJob {
static triggers = {
simple repeatInterval: 1000
}
void execute() {
print "Job run!"
}
}
The above example will call the ‘execute’ method every second.
Currently plugin supports three types of triggers:
Multiple triggers per job are allowed.
class MyJob {
static triggers = {
simple name: 'simpleTrigger', startDelay: 10000, repeatInterval: 30000, repeatCount: 10
cron name: 'cronTrigger', startDelay: 10000, cronExpression: '0/6 * 15 * * ?'
custom name: 'customTrigger', triggerClass: MyTriggerClass, myParam: myValue, myAnotherParam: myAnotherValue
}
void execute() {
println "Job run!"
}
}
With this configuration job will be executed 11 times with 30 seconds interval with first run in 10 seconds after scheduler startup (simple trigger), also it‘ll be executed each 6 second during 15th hour (15:00:00, 15:00:06, 15:00:12, ... — this configured by cron trigger) and also it’ll be executed each time your custom trigger will fire.
Three kinds of triggers are supported with the following parameters. The name field must be unique:
simple:name — the name that identifies the trigger;startDelay — delay (in milliseconds) between scheduler startup and first job's execution;repeatInterval — timeout (in milliseconds) between consecutive job's executions;repeatCount — trigger will fire job execution (1 + repeatCount) times and stop after that (specify 0 here to have one-shot job or -1 to repeat job executions indefinitely);cron:name — the name that identifies the trigger;startDelay — delay (in milliseconds) between scheduler startup and first job's execution;cronExpression — cron expressioncustom:triggerClass — your class which implements CalendarIntervalTriggerImpl impl;You can add the following properties to control persisteance or not persistence: