无法使用grails 使用quartz 插件运行多个作业

发布于 2025-01-07 09:46:09 字数 897 浏览 4 评论 0原文

你好,我正在使用grails 的quartz 插件。 当我只有一份工作时(我使用“create-job”命令),一切都按预期进行! 这就是作业的样子,它将每 1 秒打印一次:

class MyFirstJob{
def concurrent = false

static triggers = {
    simple name: 'myFirstJobTrigger', startDelay: 1000, repeatInterval: 1000 }

def group = "MyGroup"

    def execute(){ 
    println "MyFirstJob run!" 
}
}

现在,如果我添加另一个作业,该作业应该每 5 秒打印一次,如下所示:

class MySecondJob{
def concurrent = false

static triggers = {
    simple name: 'mySecondJobTrigger', startDelay: 1000, repeatInterval: 5000 }

def group = "MyGroup"

    def execute(){ 
    println "MySecondJob run!" 
}
}

现在会发生的是 job1 将仅每 5 秒开始工作 看来石英堵漏只能有1个作业计划 我想知道我错过了什么或做错了什么

我什至尝试了conf目录下一个名为quartz.properties的文件中的接下来两行:

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10

感谢您的帮助

hi there I'm using quartz plugin for grails.
when i have just 1 job (i used "create-job" command) everything works as expected!
this is how the job looks like and it will print every 1 second:

class MyFirstJob{
def concurrent = false

static triggers = {
    simple name: 'myFirstJobTrigger', startDelay: 1000, repeatInterval: 1000 }

def group = "MyGroup"

    def execute(){ 
    println "MyFirstJob run!" 
}
}

now if i add another job that should print every 5 sec that look like this:

class MySecondJob{
def concurrent = false

static triggers = {
    simple name: 'mySecondJobTrigger', startDelay: 1000, repeatInterval: 5000 }

def group = "MyGroup"

    def execute(){ 
    println "MySecondJob run!" 
}
}

what will happen now is that job1 will start working only every 5 seconds
it seems that quartz pluging can only have 1 job schedule
i was wondering what am i missing or doing wrong

i even tried the next 2 lines in a file called quartz.properties under conf directory:

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10

thanks for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦途 2025-01-14 09:46:09

该插件要求作业类文件名以“Job”结尾。因此,请确保 MyJob2 位于作业文件夹中名为“My2Job.groovy”的文件中

The plugin requires the job class filename to end in 'Job'. Therefore, make sure that MyJob2 is in a file named 'My2Job.groovy' in the job folder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文