使用圣杯石英插件的多个调度程序
问题描述:
我正在使用grails quartz plugin在我们的应用程序中实现调度。我用QuartzConfig.groovy props创建了一个调度器,这是一个集群调度器。我想在同一个应用程序中使用另一个调度程序进行非集群调度。使用圣杯石英插件的多个调度程序
我该如何使用相同的grails石英插件来实现这一点。
答
我这样做是resources.groovy创建一个新的调度豆:
newQuartzScheduler(org.springframework.scheduling.quartz.SchedulerFactoryBean) {
Properties properties = new Properties()
properties.setProperty('org.quartz.threadPool.threadCount', 5)
quartzProperties = properties
autoStartup = false
waitForJobsToCompleteOnShutdown = true
exposeSchedulerInRepository = false
jobFactory = ref('quartzJobFactory')
globalJobListeners = [ref("${SessionBinderJobListener.NAME}"), ref("${ExceptionPrinterJobListener.NAME}")]
}
和自举添加下面的代码。
newQuartzScheduler.addJob(grailsApplication.mainContext.getBean('org.com.jobs.JobNameJobDetail'), true)
newQuartzScheduler.start()
,由于石英插件创建为每个作业一个bean,它包括后缀在他的名字在作业名“细节”是必要的。
在我的情况下,我需要有一个不同的队列来执行我的任务之一。
石英插件添加调度程序中的所有作业。
如果您需要在两个调度所有作业看doWithApplicationContext在QuartzGrailsPlugin类
然后,你必须运行上的独立实例相同的应用程序,但指向同一个数据库。这是你想要的? – Armaiti