Java Spring boot Apache Camel Quartz JDBC调度程序
我将spring boot与apache camel一起使用,我想创建quartz调度程序,但在使用此配置时,什么都没有发生:Java Spring boot Apache Camel Quartz JDBC调度程序,java,spring,spring-boot,apache-camel,quartz-scheduler,Java,Spring,Spring Boot,Apache Camel,Quartz Scheduler,我将spring boot与apache camel一起使用,我想创建quartz调度程序,但在使用此配置时,什么都没有发生: camel: component: quartz2: properties: org: quartz: scheduler: instanceName: ClusteredSchedular
camel:
component:
quartz2:
properties:
org:
quartz:
scheduler:
instanceName: ClusteredSchedular
instanceId: AUTO
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 25
threadPriority: 5
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass: org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
dataSource: quartz
isClustered: true
clusterCheckinInterval: 20000
dataSource:
quartz:
driver: oracle.jdbc.driver.OracleDriver
URL: jdbc:oracle:thin:@localhost:1521:xe
user: test
password: test
maxConnections: 5
validationQuery: select 1 from dual
有人知道为什么这个配置不起作用吗?Camel仅从默认配置中查看此配置
org.quartz.scheduler.instanceName: DefaultQuartzScheduler
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 10
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
我更愿意使用springboot数据源来启用quartz集群
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://127.0.0.1:5432/postgres
username: postgres
password: password
quartz:
scheduler-name: quartzSchedulernot work anymore
jobStoreType: jdbc
startup-delay: PT10S
wait-for-jobs-to-complete-on-shutdown: true
properties:
org.quartz.scheduler.instanceId: AUTO
org.quartz.scheduler.jmx.export: true
org.quartz.threadPool.threadCount: 15
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.tablePrefix: QRTZ_
org.quartz.jobStore.isClustered: true
org.quartz.jobStore.clusterCheckinInterval: 1000
感谢您的回答,这将非常有效,但我为自动创建选项卡quartz添加了一个参数:作业存储类型:jdbc jdbc:initializeschema:always comment prefix:“#”使用这样的配置,我得到
org.quartz.SchedulerConfigException:DataSource name not set.
exception。问题是它不接受spring.jdbc.connections中的(在我的情况下是多个)数据源如果您有多个数据源,您必须明确在SpringBoot 2.3.9和Camel 3.4.3上使用的quartz配置。上面的配置似乎被忽略,并使用默认的quartz配置。对我有效的是指定:camel.component.quartz.properties file=my-quartz.properties。但是我必须将我的spring数据源复制到这个文件中。示例:org.quartz.dataSource.myDS.driver=org.h2.driver org.quartz.dataSource.myDS.URL=…etc org.quartz.jobStore.dataSource=myDS如果我可以引用application.properties/yml中配置的spring数据源(我有多个)就好了。