Spring integration 收到响应后,如何将请求和响应发送到不同的通道
假设我将CustomerRequest对象接收到输入通道通道1。 现在我必须进行一个webservice调用,它将返回bankaccount对象的列表。 我必须汇总每个账户的余额,并将其设置到CustomerRequest对象上。 现在我需要将CustomerRequest对象发送到另一个通道2,并将bankaccount对象列表发送到另一个通道3 我不确定在进行webservice调用后如何继续 非常感谢您的帮助Spring integration 收到响应后,如何将请求和响应发送到不同的通道,spring-integration,Spring Integration,假设我将CustomerRequest对象接收到输入通道通道1。 现在我必须进行一个webservice调用,它将返回bankaccount对象的列表。 我必须汇总每个账户的余额,并将其设置到CustomerRequest对象上。 现在我需要将CustomerRequest对象发送到另一个通道2,并将bankaccount对象列表发送到另一个通道3 我不确定在进行webservice调用后如何继续 非常感谢您的帮助 <si:chain id="dataChain" input-channe
<si:chain id="dataChain" input-channel="channel 1" output-channel="Channel 2" >
<si:header-enricher >
<si:header name="Content-Type" value="application/json" />
</si:header-enricher>
<si-http:outbound-gateway id="Gateway1"
url="http://$webservice{host}"
http-method="POST"
rest-template="restTemplate"
expected-response-type="com.xxx.response.Response1">
</si-http:outbound-gateway>
</si:chain>
使用一个。来自enricher的下游流应该调用web服务并返回总和
enricher看起来像
<enricher input-channel="channel1" output-channel="channel2"
request-channel="toWsPlusSummationFlow">
<property name="balance" expression="payload" />
</enricher>
这假定入站有效负载具有setBalance。。。和设置帐户。。。方法和浓缩流的结果有一个带有getCalculatedBalance和getAccounts的有效负载
该名称是解析为setter的表达式,该表达式是根据下游流的回复进行计算的表达式
或者,如果您不希望有效负载中包含数据,可以使用元素将其放在标题中。谢谢您提供的信息。充实消息只有余额,即原始请求和总余额。但我还想将从Web服务收到的银行账户列表发送到另一个渠道。我们如何实现这一点?如果下游流返回一个富对象POJO;可以添加多个元素。我会更新答案。
<enricher input-channel="channel1" output-channel="channel2"
request-channel="toWsPlusSummationFlow">
<property name="balance" expression="payload.calculatedBalance" />
<property name="accounts" expression="payload.accounts" />
</enricher>