使用圣杯石英插件的多个调度程序

编程入门 行业动态 更新时间:2024-10-10 09:15:33
本文介绍了使用圣杯石英插件的多个调度程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用grails quartz插件在我们的应用程序中实施日程安排。我用QuartzConfig.groovy props创建了一个调度器,这是一个集群调度器。我希望在同一个应用程序中有一个调度程序用于非集群调度。

I am using grails quartz plugin to implement scheduling in our app. I've created one scheduler with QuartzConfig.groovy props, which is Clustered scheduler. I want one more scheduler in the same app for Non-Clustered scheduling.

如何使用相同的grails quartz插件实现此目的。

How can I achieve this using same grails quartz plugin.

推荐答案

我在resources.groovy中创建一个新的调度器bean:

I do this creating a new scheduler bean in 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}")] }

并在BootStrap中添加下面的代码。

and add the below code in BootStrap.

newQuartzScheduler.addJob(grailsApplication.mainContext.getBean('org.jobs.JobNameJobDetail'), true) newQuartzScheduler.start()

工作名称中的'详细信息'是必需的ry,因为Quartz插件为每个作业创建一个bean,并且在他的名字中包含该后缀。

That 'Detail' in job name is necessary because Quartz plugin create a bean for each job and it includes that suffix at his names.

在我的情况中,我需要一个不同的队列来执行其中一个我的工作。

In my case, I need to have a different queue to execute only one of my jobs.

石英插件添加您调度程序中的所有工作。

The quartz plugin add all jobs in your scheduler.

如果您需要拥有所有两个调度程序中的作业都可以在QuartzGrailsPlugin类中看到doWithApplicationContext

If you need to have all your jobs in both schedulers see doWithApplicationContext in QuartzGrailsPlugin class

更多推荐

使用圣杯石英插件的多个调度程序

本文发布于:2023-11-25 20:54:20,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   插件   圣杯   程序   石英

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!