【发布时间】:2016-02-19 22:57:39
【问题描述】:
我在 karaf 4.0.3 中遇到了 apache camel 石英 cron 计时器的问题。似乎石英作业执行时,它被执行了多次。以下示例蓝图作为我的“mass-orchestrator”应用程序的一部分加载。 Hello World 输出会立即打印出多次。相反,它应该每 2 分钟打印一次。有谁知道这里发生了什么以及如何纠正它?
<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 并安装最新的骆驼(但我能够在回到 2.12 的骆驼的许多版本中重现)。
__ __ ____
/ //_/____ __________ _/ __/
/ ,< / __ `/ ___/ __ `/ /_
/ /| |/ /_/ / / / /_/ / __/
/_/ |_|\__,_/_/ \__,_/_/
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()>
【问题讨论】:
标签: apache-camel quartz-scheduler apache-karaf blueprint-osgi