2

I'm trying to externalize the QuartzConfig.groovy

I want to be able to set autoStartup to true or false with an external file.

In Config.groovy it is possible to use the grails.config.locations and set properties file that override the properties. Is there something like this in QuartzConfig.groovy ?

Thank you

erickson
  • 265,237
  • 58
  • 395
  • 493
Mike
  • 2,354
  • 3
  • 23
  • 37

4 Answers4

1

QuartzConfig.groovy still doesn't have an externalized configuration mechanism built-in.

We had the same question back in '10. Our solution was to fork the plugin and use the built-in configuration with it's externalized config

Fast forward to now (March '11) and It looks like the quartz plugin has implemented some new features.

https://github.com/grails-plugins/grails-quartz/blob/master/QuartzGrailsPlugin.groovy (checkout the loadQuartzConfig() section at the end of the file)

It looks like the functionality is extensible via the default Config.groovy config.locations mechanism.

This is what it appears to be doing:

  • loads the default config (Config.groovy)
  • merges in the DefaultQuartzConfig on from the classLoader
  • merges in the QuartzConfig from the classLoader
  • loads the quartz.properties from the classLoader

You can setup your configuration in Config.groovy now if you want.

AndreyT
  • 1,449
  • 1
  • 15
  • 28
Colin Harrington
  • 4,459
  • 2
  • 27
  • 32
0

Starting Quartz in Bootstrap based on a regular config variable worked best for me.

QuartzConfig.groovy:

quartz {
    autoStartup = false
}

BootStrap.groovy:

class BootStrap {

    def grailsApplication
    def quartzScheduler

    def init = { servletContext ->
        if(grailsApplication.config.startQuartz)
            Thread.start { quartzScheduler.start() }
    }
}

Thanks to Burt. http://grails.1312388.n4.nabble.com/Reduce-Quartz-Plugin-Start-up-Time-td1371547.html

gabe
  • 1,127
  • 1
  • 11
  • 23
0

You may want to look 3.4 Externalized Configuration of http://www.grails.org/doc/1.0.x/guide/3.%20Configuration.html.

Though I haven't try externalize for quartz, I have use this to externalize logging:

grails.config.locations = ["file:${userHome}/logger.groovy"]

And it works perfectly.

user2427
  • 7,842
  • 19
  • 61
  • 71
0

No, you can't. See this jira for more information.

james.cookie
  • 357
  • 5
  • 14