2016-09-28 81 views
0

我有一個代碼負載共享 - Spring集成

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

這個執行後調用

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

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

,但我沒能獲得任何參數ameter在這裏,因爲它有1個作爲有效載荷的值,這是以前查詢執行的狀態,我如何共享有效載荷,以便我可以獲得可用於先前查詢的所有參數。

回答

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 --> 
+0

當你在firstgateway之前或第一個網關之後說,它需要放置在哪裏。 –

+0

我能夠通過使用鏈來完成它,謝謝 –

+0

我正在使用鏈,但輸出通道沒有執行? \t \t <! - 鏈事務 - > \t