如何使 apache camel quartz2 调度器集群化
How to make apache camel quartz2 scheduler clustered
我的应用程序中有一个 camel 路由,它由 cron 表达式触发。我正在为此使用 camel quartz2 调度程序,但我不确定如何使 quartz2 集群化,因为我们需要在多个节点上部署此应用程序。
以下是开始骆驼路线的触发器。
from("quartz2://foo?cron=1+1+1+*+*+?&trigger.timeZone=Australia/Melbourne")
谁能帮我在集群环境中配置它。
当我执行这条路线时,我得到了关注:
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
看来你是误会了'NOT STARTED'留言。石英实际上是在您的情况下启动的。请等待时间满足您的 cron 表达式以启动 job/application。
要查看 quartz 的日志记录设置,Visit here.
这是通过将 org.quartz.jobStore.isClustered
设置为 true
来实现的。这是来自 the official documentation 的引述:
Enable clustering by setting the “org.quartz.jobStore.isClustered” property to “true”. Each instance in the cluster should use the same copy of the quartz.properties file. Exceptions of this would be to use properties files that are identical, with the following allowable exceptions: Different thread pool size, and different value for the “org.quartz.scheduler.instanceId” property. Each node in the cluster MUST have a unique instanceId, which is easily done (without needing different properties files) by placing “AUTO” as the value of this property.
要使用 Camel 配置它,您必须将 quartz.properties
文件放在 src/main/resources/org/quartz
中。或者,您可以自定义 Quartz 组件并提供自定义属性文件或 Properties
的实例。看看 the official Camel documentation.
我的应用程序中有一个 camel 路由,它由 cron 表达式触发。我正在为此使用 camel quartz2 调度程序,但我不确定如何使 quartz2 集群化,因为我们需要在多个节点上部署此应用程序。 以下是开始骆驼路线的触发器。
from("quartz2://foo?cron=1+1+1+*+*+?&trigger.timeZone=Australia/Melbourne")
谁能帮我在集群环境中配置它。
当我执行这条路线时,我得到了关注:
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
看来你是误会了'NOT STARTED'留言。石英实际上是在您的情况下启动的。请等待时间满足您的 cron 表达式以启动 job/application。 要查看 quartz 的日志记录设置,Visit here.
这是通过将 org.quartz.jobStore.isClustered
设置为 true
来实现的。这是来自 the official documentation 的引述:
Enable clustering by setting the “org.quartz.jobStore.isClustered” property to “true”. Each instance in the cluster should use the same copy of the quartz.properties file. Exceptions of this would be to use properties files that are identical, with the following allowable exceptions: Different thread pool size, and different value for the “org.quartz.scheduler.instanceId” property. Each node in the cluster MUST have a unique instanceId, which is easily done (without needing different properties files) by placing “AUTO” as the value of this property.
要使用 Camel 配置它,您必须将 quartz.properties
文件放在 src/main/resources/org/quartz
中。或者,您可以自定义 Quartz 组件并提供自定义属性文件或 Properties
的实例。看看 the official Camel documentation.