首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >camel-quartz在karaf中不能正常工作

camel-quartz在karaf中不能正常工作
EN

Stack Overflow用户
提问于 2016-02-20 06:57:40
回答 1查看 1.1K关注 0票数 1

我在karaf 4.0.3中遇到了一个apache camel quartz cron定时器的问题。当quartz作业执行时,它似乎被执行了多次。下面的示例blueprint是作为我的"mass-orchestrator“应用程序的一部分加载的。Hello World输出会立即多次打印出来。相反,它应该每2分钟打印一次。有人知道这里发生了什么以及如何纠正它吗?

代码语言:javascript
复制
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
  xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0"
  xsi:schemaLocation="
    http://www.osgi.org/xmlns/blueprint/v1.0.0 
    http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

    http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
    http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd

    http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0
    http://aries.apache.org/schemas/blueprint-ext/blueprint-ext-1.1.xsd">

  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
    id="simple">
    <route>
        <from uri="quartz:myTimerName?cron=*+0/2+*+*+*+?" />
        <setBody>
            <simple>Hello World</simple>
        </setBody>
        <to uri="stream:out" />
    </route>
  </camelContext>
</blueprint>

然后,我干净地启动了Karaf并安装了最新的camel (但我能够在camel的许多版本中重现,直到2.12)。

代码语言:javascript
复制
       __ __                  ____
   / //_/____ __________ _/ __/
  / ,<  / __ `/ ___/ __ `/ /_
 / /| |/ /_/ / /  / /_/ / __/
/_/ |_|\__,_/_/   \__,_/_/

Apache Karaf (4.0.3)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> feature:repo-add camel
Adding feature url mvn:org.apache.camel.karaf/apache-camel/LATEST/xml/features
karaf@root()> feature:install camel-blueprint
karaf@root()> feature:install camel-quartz
karaf@root()> feature:install camel-stream
karaf@root()> install mvn:com.cerner.cts.oss/mass-orchestrator/1.0.0-SNAPSHOT
Bundle ID: 66
karaf@root()> list
START LEVEL 100 , List Threshold: 50
ID | State     | Lvl | Version         | Name
----------------------------------------------------------------------------------
52 | Active    |  80 | 2.17.0.SNAPSHOT | camel-blueprint
53 | Active    |  80 | 2.17.0.SNAPSHOT | camel-catalog
54 | Active    |  80 | 2.17.0.SNAPSHOT | camel-commands-core
55 | Active    |  80 | 2.17.0.SNAPSHOT | camel-core
56 | Active    |  80 | 2.17.0.SNAPSHOT | camel-karaf-commands
57 | Active    |  80 | 2.2.6.1         | Apache ServiceMix :: Bundles :: jaxb-impl
58 | Active    |  80 | 3.1.4           | Stax2 API
59 | Active    |  80 | 4.4.1           | Woodstox XML-processor
60 | Active    |  80 | 2.17.0.SNAPSHOT | camel-quartz
61 | Active    |  80 | 1.4             | Commons DBCP
62 | Active    |  80 | 1.6.0           | Commons Pool
63 | Active    |  80 | 1.1.1           | geronimo-jta_1.1_spec
64 | Active    |  80 | 1.8.6.1         | Apache ServiceMix :: Bundles ::     quartz
65 | Active    |  80 | 2.17.0.SNAPSHOT | camel-stream
66 | Installed |  80 | 1.0.0.SNAPSHOT  | mass-orchestrator
karaf@root()> start 66
karaf@root()> Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
<snip>

karaf@root()>
EN

回答 1

Stack Overflow用户

发布于 2016-02-20 15:40:58

cron应该是

代码语言:javascript
复制
0+0/2+*+*+*+?

每2分钟只跑一次。如果你使用*,这意味着它每隔2分钟运行一次。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35516600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档