Spring integration 收件人列表路由器在通道中发送错误的有效负载
这是我的SpringIntegrationInboundandOutbound,它从一个端点获取一个列表Spring integration 收件人列表路由器在通道中发送错误的有效负载,spring-integration,Spring Integration,这是我的SpringIntegrationInboundandOutbound,它从一个端点获取一个列表 <http:inbound-gateway id="webListGateway" request-channel="fromWeb_List" reply-channel="toWeb_List" path="/api/profile/V1/get" supported-methods="GET">
<http:inbound-gateway id="webListGateway"
request-channel="fromWeb_List"
reply-channel="toWeb_List"
path="/api/profile/V1/get"
supported-methods="GET">
<http:header name="container" expression="#pathVariables.container"/>
<http:header name="groupName" expression="#pathVariables.groupName"/>
<http:header name="userId" expression="#pathVariables.userId"/>
</http:inbound-gateway>
<int:header-enricher input-channel="fromWeb_List" output-channel="toCloud_List">
<int:header name="apikey" value=“1234”/>
</int:header-enricher>
<http:outbound-gateway id="profileListGateway"
request-channel="toCloud_List"
reply-channel="sync_preferences"
url=“localhost:8081/containers/{container}/groups/{groupName}/values/hierarchy/{userId}"
http-method="GET"
expected-response-type="java.lang.String"
charset="UTF-8"
extract-request-payload="false"
header-mapper="headerMapper"
encode-uri="true" >
<http:uri-variable name="container" expression="headers.container"/>
<http:uri-variable name="groupName" expression="headers.groupName"/>
<http:uri-variable name="userId" expression="headers.userId"/>
</http:outbound-gateway>
<int:recipient-list-router id="syncRouter" input-channel="sync_preferences">
<int:recipient channel="toWeb_List"/>
<int:recipient channel="toCloud_Save"/>
</int:recipient-list-router>
我面临的问题是收件人列表路由器,而不是将我们在第一次呼叫中得到的列表发送给请求者,它正在从第二个调用发送响应,这是保存成功的响应。考虑使用单向http:outbound channel adapter
,而不是像现在对第二个调用那样使用请求-应答网关-对于该SaveGateway
bean定义:
<http:outbound-channel-adapter id="SaveGateway"
channel="toCloud_Save"
url=“localhost:8082/containers/{container}/groups/{groupName}/values/multiple/users"
http-method="PUT"
charset="UTF-8"
extract-payload="true"
header-mapper="headerMapper"
encode-uri="true" >
<http:uri-variable name="container" expression="headers.container"/>
<http:uri-variable name="groupName" expression="headers.groupName"/>
</http:outbound-channel-adapter>
谢谢,我正在使用reply channel=“nullChannel”以便可以重新使用现有网关。
<http:outbound-channel-adapter id="SaveGateway"
channel="toCloud_Save"
url=“localhost:8082/containers/{container}/groups/{groupName}/values/multiple/users"
http-method="PUT"
charset="UTF-8"
extract-payload="true"
header-mapper="headerMapper"
encode-uri="true" >
<http:uri-variable name="container" expression="headers.container"/>
<http:uri-variable name="groupName" expression="headers.groupName"/>
</http:outbound-channel-adapter>