2014-04-14 41 views
0

我试图实现WireTapJava DSL Fluent Builders,它给出了以下示例代码片段。骆驼+ Java带有真正的ActiveMQ Broker的DSL Fluent构建器

from("direct:start") 
.to("log:foo") 
.wireTap("direct:tap") 
.to("mock:result"); 

如果用完一个模拟示例(例如骆驼示例-JMS-文件)这工作。但是,如果我采取示例代码并尝试替换一个真正的Broker实例和Queue来替换模拟对象,它会失败,并显示以下错误。

from("tcp://localhost:61616") 
.to("ativemq:atsUpdateQueue") 
.wireTap("activemq:fdmCaptureQueue"); 

然后失败

org.apache.camel.FailedToCreateRouteException: Failed to create route route2: Route(route2)[[From[tcp://localhost:61616?queue=atsUpdateQue... because of Failed to resolve endpoint: tcp://localhost:61616?queue=atsUpdateQueue due to: No component found with scheme: tcp 

我已经广泛一派,所有的例子中,我发现利用虚拟模拟队列似乎没有说明一个真正的经纪工作,但我无法找到任何关于camel的URI规范的文档。

回答

0

谢谢你这些建议虽然有助于增加我的理解,但实际上并没有解决我的问题。我的代码错了,为了别人的利益,我应该使用下列名称。

final String sourceQueue = "activemq:queue:atsUpdateQueue"; 
    final String destinationQueue = "activemq:queue:atsEndPoint"; 
    final String wiretapQueue = "activemq:queue:fdmCaptureQueue"; 

    from(sourceQueue).wireTap(wiretapQueue).copy().to(destinationQueue); 
1

错误信息的重要组成部分,描述问题No component found with scheme: tcp,这是具有因有骆驼不“TCP”组件,但是你可以使用网状组件,如果你想用TCP端点交互:

from("netty:tcp://localhost:61616") 
这里

更多信息 - http://camel.apache.org/netty.html

1

“TCP://本地主机:61616” 的模样ActiveMQ代理地址。 您需要设置代理地址的ActiveMQ组件使用Java DSL

camelContext.addComponent("activemq", activeMQComponent("tcp://localhost:61616")); 

或Spring配置文件

<bean id="activemq" 
     class="org.apache.activemq.camel.component.ActiveMQComponent"> 
     <property name="brokerURL" value="tcp://somehost:61616"/> 
</bean> 

您可以找到有关骆驼的ActiveMQ更多信息here