【发布时间】:2013-03-31 15:06:26
【问题描述】:
在骆驼路由器中我有下面的路由。
from("jetty:http://localhost:9092?matchOnUriPrefix=true").
to("http://server:9093/service1?bridgeEndpoint=true&throwExceptionOnFailure=false")
.to("http://server:9094/service2?bridgeEndpoint=true&throwExceptionOnFailure=false")
.to("log:output")
上述路由工作正常。
但我的要求是在发送到 service2 之前修改 service1 的输出。就像我得到
<x>abc</x>
我必须把它转换成
<y><x>abc</x></y>
我尝试使用处理器,但我将 service2 的 exchange.getOut() 设为 null,而实际上它返回了 xml。
如果可能的话,有人可以帮助我吗?如果问题不清楚,请告诉我。
【问题讨论】:
-
你能显示你的处理器代码吗?
-
嗨@user-soma,下面是我的处理器代码。
.process(new Processor() { @Override public void process(Exchange exchange) throws Exception { Message in = exchange.getOut(); exchange.getOut().setBody(convertIncomingRequestToOutgoingRequest(in.getBody(IncomingRequest.class))); }
标签: rest apache-camel