2014-02-11 74 views
0

進行竊聽,我需要用駱駝做竊聽。使用Apache的駱駝

下面是一段代碼,我已經寫了

from("jetty:http://xyz:8080?enableMultipartFilter=false") 
        .streamCaching() 
        .wireTap("direct:tap").copy(true).process(new WireTapProcessor()).end() 
.process(new RequestProcessor()) 
.to("file:Z:/Testing/input"); 

當上面的代碼執行時,它給了我異常NoDirectConsumersAvailable。

可否請你建議如何在上述情況下進行竊聽

回答

0

那麼你發送搭線的直接消費者,但你不要建立一個直接的消費者途徑或者換句話說,你從來沒有定義其他途徑來處理電線水龍頭。我在這裏使用seda隊列而不是直接隊列。

嘗試以下操作:

from("jetty:http://xyz:8080?enableMultipartFilter=false") 
       .streamCaching() 
       .wireTap("seda:wiretapqueue") 
.process(new RequestProcessor()) 
.to("file:Z:/Testing/input"); 

from("seda:wiretapqueue").to("somecomponent:foo"); 

這應該解決您的問題。另請參閱this link

+0

使用上面給了我的異常爲: – user3265703

+0

它提供了異常:異常在線程「主要」 org.apache.camel.FailedToStartRouteException:無法啓動路由路徑2,因爲多個消費者對同一端點是不允許的: Endpoint [direct:// tap] \t at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:2142) – user3265703

+0

我們已經添加了routebuilder並啓動了camel,如下所示:Main main = new Main(); main.enableHangupSupport(); main.addRouteBuilder(new XyzRouteBuilder()); main.run(args); – user3265703