Grails Quartz 插件在启用持久性的情况下在启动时删除触发器

发布于 2024-11-07 23:04:37 字数 2025 浏览 1 评论 0原文

我遇到了以下问题:我有一个带有quartz 插件的grails 应用程序和一个持久存储(Oracle)。我的作业类有一个空的触发器块,如下所示:

class VodServerJob {
    static triggers = {}
    def volatility = false;
    def durability = true;
    def concurrency = false;
    def group = "MyGroup"
    def execute(context) { }
}

...但我在进行过程中以编程方式添加触发器(让用户安排作业的启动时间)。当我关闭应用程序时,触发器仍在数据库中。但在启动时,触发器被删除,从而破坏了持久存储的意义。

我的配置如下:

quartz {
    autoStartup = true
    jdbcStore = true
    waitForJobsToCompleteOnShutdown = true
}

environments {
    test { quartz { autoStartup = false } }
}

我的属性如下:

#============================================================================
# Configure ThreadPool  
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5

#============================================================================
# Configure JobStore  
#============================================================================

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_

#============================================================================
# Configure Datasources  
#============================================================================

org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@172.27.5.18:1521:dcrm
org.quartz.dataSource.myDS.user = <hidden, but valid>
org.quartz.dataSource.myDS.password = <hidden, but valid>
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual

根据我所看到的一切,这应该允许数据库持久性,但是,它在启动时被删除。有人知道为什么吗?

I'm encountering the following problem: I've got a grails app, with the quartz plugin, and a persistent storage (Oracle). My job class has an empty triggers block like so:

class VodServerJob {
    static triggers = {}
    def volatility = false;
    def durability = true;
    def concurrency = false;
    def group = "MyGroup"
    def execute(context) { }
}

...but I programatically add the triggers as I go along (letting the user schedule kick-off times for a job). When I shut down the app, the triggers are still in the database. But on startup, the triggers are removed, defeating the point of persistent storage.

My config is as follows:

quartz {
    autoStartup = true
    jdbcStore = true
    waitForJobsToCompleteOnShutdown = true
}

environments {
    test { quartz { autoStartup = false } }
}

and my properties are as follows:

#============================================================================
# Configure ThreadPool  
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5

#============================================================================
# Configure JobStore  
#============================================================================

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_

#============================================================================
# Configure Datasources  
#============================================================================

org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@172.27.5.18:1521:dcrm
org.quartz.dataSource.myDS.user = <hidden, but valid>
org.quartz.dataSource.myDS.password = <hidden, but valid>
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual

According to everything I can see, this should allow for DB persistence, and yet, it's getting removed on startup. Anyone have any ideas as to why?

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

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

发布评论

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

评论(1

じее 2024-11-14 23:04:37

找到了这个问题的答案。默认情况下,触发器设置为易失性,这意味着它们在启动时被删除。只需按如下方式将触发器的 volatility 设置为 false 即可无限期地保留触发器。

trigger.setVolatility(false);

否则,它们将被擦除。

Found the answer on this one. Triggers are set to volatile by default, which means they are deleted on startup. Just set volatility of the trigger to false as follows for your triggers to be indefinitely persisted.

trigger.setVolatility(false);

Otherwise, they'll get wiped.

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