【问题标题】:How to make apache camel quartz2 scheduler clustered如何使 apache camelquartz2 调度程序集群化
【发布时间】:2016-12-03 19:47:07
【问题描述】:

我的应用程序中有一条骆驼路线,它通过 cron 表达式触发。我为此使用骆驼石英2调度程序,但我不确定如何使石英2集群化,因为我们需要在多个节点上部署此应用程序。 以下是开始骆驼路线的触发器。

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.

【问题讨论】:

  • 您能否详细说明点-集群环境?期望是什么?

标签: cron apache-camel quartz-scheduler


【解决方案1】:

这是通过将org.quartz.jobStore.isClustered 设置为true 来实现的。这是the official documentation的引述:

通过将“org.quartz.jobStore.isClustered”属性设置为“true”来启用集群。集群中的每个实例都应使用quartz.properties 文件的相同副本。例外情况是使用相同的属性文件,但允许的例外情况如下:不同的线程池大小,以及“org.quartz.scheduler.instanceId”属性的不同值。集群中的每个节点都必须有一个唯一的 instanceId,这很容易通过将“AUTO”作为该属性的值来完成(不需要不同的属性文件)。

要使用 Camel 进行配置,您必须将 quartz.properties 文件放在 src/main/resources/org/quartz 中。或者,您可以自定义 Quartz 组件并提供自定义属性文件或Properties 的实例。看看the official Camel documentation

【讨论】:

  • 谢谢米洛斯,我明白了。
  • 我还有一个问题。是否可以在不使用数据库表的情况下使调度程序集群化
  • 不幸的是,据我所知,没有数据库,您的实例将无法正确同步。
【解决方案2】:

您似乎误解了“未开始”消息。石英实际上是在你的情况下开始的。请等到时间符合您的 cron 表达式以启动作业/应用程序。 要查看石英的日志记录设置,Visit here.

【讨论】:

  • 感谢 Jayaraj,我知道它已启动,但未在集群模式下启动。我想以集群模式启动它。我知道我可以使用属性文件来做到这一点,但我无法配置属性文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多