有效负载共享 - spring integration

时间:2016-09-28 09:32:07

标签: spring-integration

我有一个代码

	<int-jpa:updating-outbound-gateway
		request-channel="nativeQlChannel" auto-startup="true"
		native-query="update Transactions t set t.transaction_Status = :transactionStatus where t.bank_Reference_Number = :bankReferenceNumber "
		entity-manager="entityManager" persist-mode="PERSIST" reply-channel="nativeQlChannelOne"
		use-payload-as-parameter-source="false">

执行此操作后,调用

	<int-jpa:outbound-channel-adapter
		channel="nativeQlChannel" entity-class="org.ncb.quickpay.grs.persistence.entities.PartnerResponseDetails"
		persist-mode="PERSIST" entity-manager="entityManager" >
		<int-jpa:transactional/>
		</int-jpa:outbound-channel-adapter>

		<int-jpa:outbound-channel-adapter
			channel="nativeQlChannelOne"
			native-query="update Transactions t set t.transaction_Status = :transactionStatus where t.bank_Reference_Number = :bankReferenceNumber "
			entity-manager="entityManager">
			<int-jpa:transactional />
			<int-jpa:parameter name="transactionStatus"
				expression="payload['transactionStatus']" />
			<int-jpa:parameter name="bankReferenceNumber"
				expression="payload['bankReferenceNumber']" />
</int-jpa:outbound-channel-adapter>

但我无法在这里得到任何参数,因为它在有效载荷中有1作为前一个查询执行状态的值,我如何共享有效载荷以便我可以获得以前可用的所有参数查询。

1 个答案:

答案 0 :(得分:0)

一种常见的模式是在头部中存储对有效载荷的引用;然后恢复它......

<int:header-enricher ...> <!-- before the first gateway -->
    <int:header name="savePayload" expression="payload">
</int:header-enricher>


<int:transformer ... expression="headers.savePayload"> <!-- after the first gateway -->