Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache camel 使用apachecamel执行窃听_Apache Camel - Fatal编程技术网

Apache camel 使用apachecamel执行窃听

Apache camel 使用apachecamel执行窃听,apache-camel,Apache Camel,我需要用骆驼做窃听 下面是我写的一段代码 from("jetty:http://xyz:8080?enableMultipartFilter=false") .streamCaching() .wireTap("direct:tap").copy(true).process(new WireTapProcessor()).end() .process(new RequestProcessor()) .to("file

我需要用骆驼做窃听

下面是我写的一段代码

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


请您建议如何在上述场景中执行窃听

好吧,您将窃听发送给直接消费者,但您没有创建直接消费者路线,或者换句话说,您从未定义处理窃听的其他路线。我在这里使用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");

这将解决您的问题。另请参见

使用上面的它给我异常:它给我异常:线程“main”org.apache.camel.FailedToStartRouteException中的异常:无法启动路由route2,因为不允许使用同一端点的多个使用者:endpoint[direct://tap]位于org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:2142)我们已经添加了routebuilder并按如下方式启动了camel:Main Main=new Main();Main.enableHangupSupport();Main.addRouteBuilder(new XyzRouteBuilder());Main.run(args);请在seda队列中试用它。您应该使用.wireTap(“direct:mytap”),然后使用from(“direct:mytap”)