4 Plugin Configuration
Version: 3.0.0-SNAPSHOT
4 Plugin Configuration
Configuring the plugin
The plugin supports configuration settings defined in grails-app/conf/application.yml.---
quartz:
autoStartup: true
autoStartup
controls automatic startup of the Quartz scheduler during application bootstrap (default: true )jdbcStore
set to true if you want Quartz to persist jobs in your DB (default: false ), you'll also need to provide quartz.properties file and make sure that required tables exist in your db (see Clustering section below for the sample config and automatic tables creation using Hibernate)
Logging
A log is auto-injected into your task Job class without having to enable it. To set the logging level, just add something like this to your grails-app/conf/Config.groovy log4j configuration.debug 'grails.app.jobs'
Hibernate Sessions and Jobs
Jobs are configured by default to have Hibernate Session bounded to thread each time job is executed. This is required if you are using Hibernate code which requires open session (such as lazy loading of collections) or working with domain objects with unique persistent constraint (it uses Hibernate Session behind the scene). If you want to override this behavior (rarely useful) you can use 'sessionRequired' property:static sessionRequired = false
Configuring concurrent execution
By default Jobs are executed in concurrent fashion, so new Job execution can start even if previous execution of the same Job is still running. If you want to override this behavior you can use 'concurrent' property, in this case Quartz's StatefulJob will be used (you can find more info about it here):static concurrent = false
Configuring Job Enabled
By default all jobs are considered enabled. In some cases it may be desired to temporarily disable a job. This can be done by overriding the jobEnabled property behaviorstatic jobEnabled = false
Configuring description
Quartz allows for each job to have a short description. This may be configured by adding a description field to your Job. The description can be accessed at runtime using the JobManagerService and inspecting the JobDetail object.static description = "Example Job Description"