【发布时间】:2019-12-12 21:04:29
【问题描述】:
我在 Docker 网络中有两个 Apache Camel 路由器。
它充当客户端,并通过路由将主体中的一些数据发送到外部。
我现在想从服务器路由器获取修改后的主体。
但显然身体修改从未应用。
(对于上下文,初始请求是一个发布请求,最终主体应该是响应)
这是我的“客户”路线的样子:
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<restConfiguration component="restlet" bindingMode="json" port="8989" enableCORS="true"/>
<rest path="/finData">
<description>User rest service</description>
<post>
<to uri="direct:update"/>
</post>
</rest>
<route id="sendFinData">
<from uri="direct:update"/>
<log message="Got some data: ${body}"/>
<to uri="aclient://otherClient:9191"/>
</route>
这是“服务器”的样子:
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="receiveFinData">
<from
uri="aserver://0.0.0.0:9191"/>
<log message="Received via data: ${body}"/>
<setBody>
<simple>{"result": true }</simple>
</setBody>
</route>
更新:如果我向“客户端”添加第二条路由并调用此路由而不是“服务器”的外部并修改它正在工作的主体
【问题讨论】:
-
用
代替... 怎么样? -
为什么简单版不行?是否在
{...}前面假设$? -
不幸的是,这不起作用。对于上下文:如果我在第一个“客户端”实例中添加一个路由并在那里修改它的主体
标签: rest apache-camel spring-camel