編輯:騾子3.4.1騾子事務回滾範圍出現失敗
我們有一個騾子流是交替從一個數據庫插入到另一個,都包裹事務的範圍內讀取。在這種特殊情況下,後面的插入之一會失敗,我們期望所有內容都回滾。
當我們查看日誌時,第二次插入(即下例中的BulkInsertInstanceToCache)會出現異常(例如重複的PRIMARY KEY)。當我們查看數據庫時,會看到第一個插入的數據(下例中的BulkInsertActivityToCache)。我們預計所有數據都會消失。
我們是否爲我們想要的行爲錯誤地配置此範圍?
下面是一個代碼示例,我將它縮減爲兩個插入,以顯示正在處理的處理類型。
<flow name="ProcessBulkUpdateCache" processingStrategy="synchronous" doc:name="ProcessBulkUpdateCache">
<transactional action="ALWAYS_BEGIN" doc:name="Transactional">
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="GetActivitiesForCache" queryTimeout="-1" connector-ref="SumTotalDatabase">
<jdbc-ee:transaction action="NONE" />
</jdbc-ee:outbound-endpoint>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="BulkInsertActivityToCache" queryTimeout="-1" connector-ref="EAIServiceDatabase">
</jdbc-ee:outbound-endpoint>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="GetInstancesForCache" queryTimeout="-1" connector-ref="SumTotalDatabase">
<jdbc-ee:transaction action="NONE" />
</jdbc-ee:outbound-endpoint>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="BulkInsertInstanceToCache" queryTimeout="-1" connector-ref="EAIServiceDatabase">
</jdbc-ee:outbound-endpoint>
</transactional>
<catch-exception-strategy doc:name="Unexpected">
...etc.
</catch-exception-strategy>
</flow>
編輯我嘗試添加在第一個INSERT一個BEGIN_OR_JOIN交易元素和第二的ALWAYS_JOIN交易元素,但該代碼然後當它到達第二是沒有交易開放加盟拋出異常。