gpt4 book ai didi

java - 使用 Quartz 库,如何从数据库表中读取 cron 表达式,而不是从属性文件中获取

转载 作者:行者123 更新时间:2023-12-01 16:21:45 25 4
gpt4 key购买 nike

@Scheduled(cron= "${time.export.cron}")
public void performJob() throws Exception {
// do something
}

This is from a properties file, it's working fine. but I want to read corn expression via a database table instead of getting from the properties file. How we can aware system on which time job should run.

最佳答案

当然。通过以下属性添加 org.quartz.jobStore.class 和数据库信息。

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.clusterCheckinInterval = 20000

供您引用的官方文档。 http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/configuration.html

关于java - 使用 Quartz 库,如何从数据库表中读取 cron 表达式,而不是从属性文件中获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62254506/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com