269.3. Spring Boot Auto-Configuration

组件支持 12 个选项,它们如下所列。

名称描述默认类型

camel.component.quartz2.auto-start-scheduler

调度程序是否应该自动启动。这个选项为默认 true

true

布尔值

camel.component.quartz2.enable-jmx

是否启用 Quartz JMX,它能够从 JMX 管理 Quartz 调度程序。这个选项为默认 true

true

布尔值

camel.component.quartz2.enabled

启用 quartz2 组件

true

布尔值

camel.component.quartz2.interrupt-jobs-on-shutdown

是否要在关闭时中断作业,它会强制调度程序更快地关闭并尝试中断任何正在运行的作业。如果启用此项,则任何正在运行的作业可能会因为中断而失败。

false

布尔值

camel.component.quartz2.prefix-instance-name

是否使用 CamelContext 名称为 Quartz Scheduler 实例名称添加前缀。默认情况下启用此项,让每个 CamelContext 使用自己的 Quartz 调度程序实例。您可以将这个选项设置为 false,以在多个 CamelContext 间重复使用 Quartz 调度程序实例。

true

布尔值

camel.component.quartz2.prefix-job-name-with-endpoint-id

是否将 quartz 任务与端点 ID 为前缀。此选项默认为 false。

false

布尔值

camel.component.quartz2.properties

配置 Quartz 调度程序的属性。选项是 java.util.Properties 类型。

 

字符串

camel.component.quartz2.properties-file

从 classpath 中加载的属性的文件名

 

字符串

camel.component.quartz2.resolve-property-placeholders

启动时,组件是否应自行解析属性占位符。只有 String 类型的属性才能使用属性占位符。

true

布尔值

camel.component.quartz2.scheduler

要使用自定义配置的 Quartz 调度程序,而不是创建新调度程序。选项是一个 org.quartz.Scheduler 类型。

 

字符串

camel.component.quartz2.scheduler-factory

要使用自定义调度程序工厂,用于创建调度程序。选项是一个 org.quartz.SchedulerFactory 类型。

 

字符串

camel.component.quartz2.start-delayed-seconds

启动 quartz 调度程序前等待的秒数。

 

整数

例如,以下路由规则将触发两个计时器事件到 mock:results 端点:

from("quartz2://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1").routeId("myRoute")
    .to("mock:result");

使用 stateful=true 时,JobDataMap 在每次执行作业后都会重新渲染,从而保留下一次执行的状态。

INFO: 在 OSGi 中运行并具有多个带有 quartz 路由 的捆绑包,例如 Apache ServiceMix 或 Apache Karaf,并且有多个带有从 Quartz2 端点开头的 Camel 路由捆绑包,然后确保您为这个 ID 分配了一个 id 的唯一 ID,因为这是 OSGi 容器中 QuartzScheduler 需要这一 ID。如果您没有在 <camelContext> 上设置任何 id,则会自动分配一个唯一 ID,且不会出现问题。