【问题标题】:Inconsistent behavior of clustered Camel Quartz2 route群集 Camel Quartz2 路线的行为不一致
【发布时间】:2018-03-28 00:37:41
【问题描述】:

我们有一个使用 Spring(4.0.3.RELEASE) + Camel(2.13.4) + Quartz2 + Oracle11 开发的应用程序。我们正在使用 JDK 1.6 在 Websphere 7 上部署此应用程序。

我们有不同的垂直和水平集群环境。当我们使用两台不同的机器时,系统的时钟是同步的。理想的状态是让作业一次只在一台机器上运行。为此,我们使用以下属性将环境配置为集群。

org.quartz.scheduler.instanceName = UAT_CLUSTER 
org.quartz.scheduler.instanceId = AUTO
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 1
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = 
org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = oracleDs                                                         
org.quartz.jobStore.isClustered = true
org.quartz.dataSource.oracleDs.jndiURL = jdbc/oracleDs

我们看到的行为并不一致。在一个环境中,我们在同一台机器上有两个 JVM,我们看到 QRTZ_TRIGGERS 表只有一个条目

在另一种环境中,两台机器各有一个 JVM,行为有时相似,有时不相似。我们看到 QRTZ_TRIGGERS 表总是有时有一个条目,有时有两个条目

在这两种情况下,表格都会在触发时按预期更新。但是,作业没有运行,日志甚至没有踪迹。

QRTZ_TRIGGERS 表中的 SCHED_NAME 附加有 -camel-1-*。但是,行为并不一致。在一个环境中,我们有 2 台机器,每台机器都有一个 JVM,我们看到只有一个 SCHED_NAME 被添加到 QRTZ_TRIGGERS 表中。在另一个具有类似配置的环境中,我们看到添加了两个 SCHED_NAME

我们想知道表格的正确行为和预期行为以及实现该行为的方法。任何指向表格文档的链接将不胜感激。

路由很简单,定义为

@Configuration
@ComponentScan(basePackages = { "com.company.app.package" })
public class BatchConfig extends SingleRouteCamelConfiguration {

@Value("#{ systemProperties['application.environment'] }")
private String appEnv;

@Override
public RouteBuilder route() {
    return new RouteBuilder() {
        public void configure() {
            from("quartzComponent://group/trigger?cron=0+0/5+*+?+*+*&recoverableJob=true").routeId("batchRoute")
                    .beanRef("firstProcessor").beanRef("secondProcessor").end();
        };
    };
}

@Override
protected void setupCamelContext(CamelContext camelContext) throws Exception {
    camelContext.addComponent("quartzComponent", quartzComponent());
}

@Bean
public QuartzComponent quartzComponent() {
    QuartzComponent quartz = new QuartzComponent();
    quartz.setPropertiesFile("env/" + appEnv + "/quartz.properties");
    return quartz;
}

【问题讨论】:

    标签: oracle11g apache-camel load-balancing quartz-scheduler websphere-7


    【解决方案1】:

    我能够解决这个问题。问题在于孤立线程。即使在应用程序关闭后,我们也看到线程继续运行,并且 QRTZ_SCHEDULER_STATE 表将包含自服务器重新启动以来的所有先前实例。如果我删除这些条目,即使在应用程序关闭后,表格也会更新为所有实例。

    为了克服这些问题,我们使根配置文件扩展了 CamelConfiguration 并使用了扩展 RouteBuilder 并被扫描为 Spring 组件的注释类。之前我们在配置中使用 SingleRouteCamelConfiguration。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多