I am trying to do a simple background job in Grails. I just want stuff to happen every 30 seconds or so.
I am using Grails 3.1.3
I've added Quartz to my dependencies: compile "org.grails.plugins:quartz:2.0.1"
Then I've run a compile and restarted the grails CLI. Now I created a Job via create-job. It looks like this:
package htwp
class UserSyncJob {
static triggers = {
simple repeatInterval: 5000l // execute job once in 5 seconds
}
def execute() {
println ("?")
log.error("??!")
throw new Error("JOB WHERE ARE YOU");
}
}
Nothing happens when I start the server via run-app. Nothing printed, no errors either. What am I doing wrong?
I checked issues of quartz plugin for Grails project and found this issue and this issue.
Just upgrade as I said earlier in comment to the newest realese of plugin.