Spring 在上下文xml中对同一服务进行多次调用

Spring 在上下文xml中对同一服务进行多次调用,spring,spring-integration,Spring,Spring Integration,我有一个REST服务,我从spring上下文文件调用它,根据收到的响应,我可以继续其余的处理,或者使用不同的uri_变量再次调用同一个服务。 下面是我的上下文文件- <int:chain id="Search" input-channel="inputChannel" output-channel="channel1"> <int:header-enricher> <int:header name="accept" value="application/x

我有一个REST服务,我从spring上下文文件调用它,根据收到的响应,我可以继续其余的处理,或者使用不同的uri_变量再次调用同一个服务。 下面是我的上下文文件-

<int:chain id="Search" input-channel="inputChannel" output-channel="channel1">

<int:header-enricher>
    <int:header name="accept" value="application/xml" overwrite="true"/>
    <int:header name="Authorization" method="getAuth" ref="Auth"/>
 </int:header-enricher>

    <int-xml:xpath-header-enricher>
        <int-xml:header name="medId" xpath-expression="/MedicineFamily/medicineId/text()" evaluation-type="STRING_RESULT" />
 </int-xml:xpath-header-enricher>

<int-http:outbound-gateway id="ServiceGateway" http-method="GET" reply-timeout="1000" 
    expected-response-type="java.lang.String" url="https://#{environment['dataservice.address']}:#{environment['dataservice.port']}/#{environment['dataservice.paths.medId']}"
    mapped-request-headers="accept,Authorization" mapped-response-headers="medId" error-handler="ErrorHandler">
    <int-http:uri-variable name="med_id" expression="headers['medId']"/>
 </int-http:outbound-gateway>

 <int:transformer  ref="PharmacyBean" method ="formMed"/>
</int:chain>

这里,我使用一个出站网关调用一个数据服务,该出站网关的uri变量是从另一个服务调用接收到的medId。现在,基于此服务的结果和在transformer中完成的处理,我可能需要再次调用此服务,但这次使用不同的uri变量

我如何发回一个不同的变量,并用这个新的uri变量再次调用这个服务? 另外,如果我返回了多个medId,并且希望为每个medId调用服务,那么如何在循环中调用此服务?
谢谢

在网关后添加路由器,并根据需要路由回网关。当多个
medId
s时,路由到拆分器;如果需要在拆分器之后重新组装结果,请使用聚合器

在这种情况下,您可能会发现在
splitter->http->aggregator
流中添加第二个网关更容易;否则,路由器中的条件可能会变得复杂