views:

38

answers:

1

I have a job running on a grails app that I need to run with lower priority. Is there a configuration to set that?

+1  A: 

You can set the priority on a Quartz trigger like this:

myTrigger.setPriority(10);

If the priority is not set explicitly, it defaults to 5. In Grails, you can presumably (I haven't tested this) specify this within the triggers closure of the job class like this:

class MyJob {

    def execute() { 
        println "Job running!"
    }

    static triggers = {
            simple name:'highPriority', priority: 10, startDelay:10000, repeatInterval: 30000, repeatCount: 10
            cron name:'lowPriority', priority: 1, startDelay:10000, cronExpression: '0/6 * 15 * * ?'
    }
}
Don