[英]Java fire and forget cxf web service call to camel application
I have a java web application (quote engine) that makes a web service call to another java web application (multicaster) that utilises Apache camel to multicast a message to multiple endpoints. 我有一个Java Web应用程序(报价引擎),它对另一个Java Web应用程序(多播程序)进行Web服务调用,该Java Web应用程序利用Apache骆驼将消息多播到多个端点。
We are consuming a apache CXF webservice which is defined in the camel context of the multicaster project. 我们正在使用在多播器项目的骆驼上下文中定义的apache CXF Web服务。 Currently the quote engine project is not using camel.
当前,报价引擎项目未使用骆驼。
<cxf:cxfEndpoint id="caster"
address="http://localhost:${multicaster.port}/caster"
serviceClass="uk.co.glad.caster.core.casterWS"/>
For additional info here is my multicaster route 有关其他信息,这是我的多播路由
<camel:route id="casterRoute">
<camel:from ref="caster" />
<camel:process ref="initProcessor" />
<camel:multicast parallelProcessing="true" stopOnException="false" streaming="true">
<camel:to uri="direct:WebService1"/>
<camel:to uri="direct:WebService2"/>
</camel:multicast>
</camel:route>
I need to the call to the caster cxf endpoint to be fire and forget. 我需要调用Caster cxf端点,以免忘记。 I want to send a message to this service and continuing processing in quote engine project without waiting for a reply.
我想向此服务发送一条消息,并继续在报价引擎项目中进行处理,而无需等待答复。
My web service has a void return type as we dont even need a reply. 我的Web服务的返回类型无效,因为我们甚至不需要回复。
I think I may be able to solve this using the concurency api and future object but I was wondering if there was a cleaner way to do this. 我想我可以使用并发性api和future对象来解决此问题,但我想知道是否有更干净的方法可以做到这一点。 Maybe using camel config, I have read about the "inonly" parameter but I can't see how I can use this in my config.
也许使用骆驼配置,我已经阅读了“ inonly”参数,但是看不到如何在配置中使用它。
thanks 谢谢
Tom 汤姆
This was solved as Claus mentioned below using wireTap 如下面的克劳斯所述,使用wireTap解决了该问题
<cxf:cxfEndpoint id="caster"
address="http://localhost:${multicaster.port}/caster"
serviceClass="uk.co.glad.caster.core.casterWS"/>
<camel:route id="tap">
<camel:from ref="caster" />
<camel:wireTap uri="direct:casterRoute" />
</camel:route>
<camel:route id="casterRoute">
<camel:from uri="direct:casterRoute" />
<camel:process ref="initProcessor" />
<camel:multicast parallelProcessing="true" stopOnException="false" streaming="true">
<camel:to uri="direct:WebService1"/>
<camel:to uri="direct:WebService2"/>
</camel:multicast>
</camel:route>
使用窃听器eip http://camel.apache.org/wire-tap,然后您可以独立处理被窃听的消息,并且CXF Web服务可以尽快终止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.