我正在 karaf 运行一个股票示例路线。我知道它正在工作,因为当我将 stream:out 更改为 log:test 时,我可以每 5 秒看到一次日志中的消息。但是,我似乎没有在 karaf 控制台中得到任何东西。我也安装了骆驼流,在日志中看不到任何错误。我应该在运行 karaf bin/client 时看到 stream:out 数据吗?谢谢!
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<camelContext xmlns="http://camel.apache.org/schema/blueprint" id="simple">
<route>
<from uri="timer:simple?period=5000"/>
<setBody>
<simple>Hello World</simple>
</setBody>
<to uri="stream:out"/>
</route>
</camelContext>
</blueprint>
我在下面添加了功能信息。我现在使用的是 karaf 2.2.9。我在 2.3.0 上试过:
karaf@root> features:list | grep stream
[installed ] [2.9.4 ] camel-stream camel-2.9.4
[uninstalled] [2.9.4 ] camel-xstream camel-2.9.4
karaf@root> features:list | grep bluepr
[installed ] [2.9.4 ] camel-blueprint camel-2.9.4
[installed ] [5.7.0 ] activemq-blueprint activemq-5.7.0
karaf@root> ^D
我也尝试过以下方法:
service KARAF-service stop
cd /usr/local/karaf
rm -rf data/cache/*
service KARAF-service start
echo "features:install camel-blueprint camel-stream" | bin/client
cp /root/simple-camel-blueprint.xml deploy/ && tail -f data/log/karaf.log
我得到:
***deleted startup messages***
2012-12-01 14:56:42,166 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:56:47,134 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:56:52,135 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:56:57,135 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:57:02,135 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:57:07,136 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:57:12,135 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
2012-12-01 14:57:17,135 | INFO | - timer://simple | test | 64 - org.apache.camel.camel-core - 2.9.4 | Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World]
如果我将“to uri”从“log:test”更改为“stream:out”,然后运行 bin/client 我什么也得不到。这是一个有效的控制台输出测试吗?
我也应该添加这个:
karaf@root> camel:route-info route3
Camel Route route3
Camel Context: simple
Properties
id = route3
parent = 7fcb9c0a
Statistics
Exchanges Total: 5
Exchanges Completed: 5
Exchanges Failed: 0
Min Processing Time: 1ms
Max Processing Time: 5ms
Mean Processing Time: 1ms
Total Processing Time: 9ms
Last Processing Time: 1ms
Load Avg: 0.00, 0.00, 0.00
First Exchange Date: 2012-12-01 15:08:32
Last Exchange Completed Date: 2012-12-01 15:08:52
Definition
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="route3" xmlns="http://camel.apache.org/schema/spring">
<from uri="timer:simple?period=5000"/>
<setBody id="setBody3">
<simple>Hello World</simple>
</setBody>
<to uri="stream:out" id="to3"/>
</route>