2014-04-01 25 views
3

我是石英的新手。我用下面的配置配置了mysql的jdbcjobstore。 它工作正常,如果我通過Java創建一個調度程序。與MySQL的石英JDBCJobStore配置

# Main Quartz configuration 
org.quartz.scheduler.skipUpdateCheck = true 
org.quartz.scheduler.instanceName = DatabaseClusteredScheduler 
org.quartz.scheduler.instanceId = AUTO 
org.quartz.scheduler.jobFactory.class = org.quartz.simpl.SimpleJobFactory 
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX 
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate 
org.quartz.jobStore.dataSource = quartzDataSource 
org.quartz.jobStore.tablePrefix = QRTZ_ 
org.quartz.jobStore.isClustered = true 
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool 
org.quartz.threadPool.threadCount = 5 

# JobStore: JDBC jobStoreTX 
org.quartz.dataSource.quartzDataSource.driver = com.mysql.jdbc.Driver 
org.quartz.dataSource.quartzDataSource.URL = jdbc:mysql://192.168.1.2:3306/fatdb 
org.quartz.dataSource.quartzDataSource.user = root 
org.quartz.dataSource.quartzDataSource.password = root 
org.quartz.dataSource.quartzDataSource.maxConnections = 8 

我的問題是有可能把條目(如調度,任務和其他信息),直接在特定的石英錶,而無需編寫程序。

例如 如果我在石英錶中插入時間和適當的調度程序詳細信息,並且如果我用上述配置調用監聽程序,它是否工作?

如果它可以工作哪些是表格,我需要配置哪些字段。

+0

我寫過一篇關於Quartz的博客文章,它使用REST API來安排作業並使用liquibase來管理數據庫遷移。 http://juliuskrah.com/tutorial/2017/10/06/persisting-dynamic-jobs-with-quartz-and-spring/ –

回答

0

我想通了,它的工作原理。我只將值插入到3個表格中,並且它工作得很好。您需要配置的表格:[QRTZ_JOB_DETAILS],[QRTZ_TRIGGERS]和[QRTZ_CRON_TRIGGERS]。

4

您不應該直接通過SQL寫入quartz數據庫。

Quartz Best Practices


JDBC作業存儲
從不直接

寫作調度數據直接寫入到石英的表到數據庫(通過SQL),而不是
使用調度API:

數據損壞的結果(刪除的數據,加擾的數據) 個
結果在工作看似「消失」,而不當觸發的發射時間到達作業未執行「只是坐在那裏」當,當觸發的火時間到達
可能導致
結果執行:死鎖
其他怪問題和數據損壞