【问题标题】:Quartz change MisfireInstruction globallyQuartz 全局更改 MisfireInstruction
【发布时间】:2013-10-11 14:02:28
【问题描述】:

有没有办法为所有作业 (CronTrigger) 更改 MisfireInstruction 值?
我试过设置:

org.quartz.CronTrigger.misfireInstruction=2

org/quartz/quartz.properties

但是好像没有效果。

使用的石英版本是 1.8.5
与骆驼 2.10.3

请注意,我自己没有创建石英触发器,它是通过骆驼路线完成的

from("quartz://" + getJobId() + "?cron=" + cronExpression + "&stateful=true")
        .routeId(getJobId())
        .autoStartup(false)
        .to(getRouteTo());

所以我无法立即访问石英 crontrigger,这就是为什么我想在全球范围内更改失火政策。

【问题讨论】:

    标签: java apache-camel quartz-scheduler


    【解决方案1】:

    Quartz JAR 已嵌入 quartz.properties 文件,因此不确定哪个 .properties 文件被拾取。

    org.apache.camel.component.quartz.QuartzComponent 上,您可以配置要使用的自定义属性文件:

    QuartzComponent quartz = new QuartzComponent();
    quartz.setPropertiesFile("classpath:com/foo/myquartz.properties");
    

    然后将组件添加到Camel中:

    camelContext.addComponent("quartz", quartz);
    

    【讨论】:

    • 我确定我的quartz.properties 是保存在 WEV-INF/classes/org/quartz 下的那个。我更多的是寻找一个答案,即它可能或不可能普遍覆盖石英的失火政策。如果不可能,我可以做的不是停止/启动我的 cron 路由,而是动态删除和添加它们。
    猜你喜欢
    • 1970-01-01
    • 2016-10-05
    • 2011-12-23
    • 2020-04-18
    • 2013-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-19
    相关资源
    最近更新 更多