2014-04-14 39 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