webMethods Adapter Runtime 10.3 | webMethods Adapter Runtime Documentation | Adapters RunTime Users Documentation | Transaction Management | Explicit Transactions | Explicit Transaction Usage Cases | Two XAResource Transactions
 
Two XAResource Transactions
The following flow includes two XAResource transactions: one that interacts with ResourceA, and a nested transaction that interacts with ResourceB and ResourceC.
BEGIN FLOW // start transaction 1
INVOKE interactWithResourceA // service for transaction 1

INVOKE startTransaction(2) // start transaction 2
INVOKE interactWithResourceB // service for transaction 2
INVOKE interactWithResourceC // service for transaction 2
INVOKE commitTransaction(2) // commit transaction 2

END FLOW // commit transaction 1
The flow executes as follows:
1. When interactWithResourceA is invoked, Integration Server starts transaction 1 and enlists ResourceA.
2. Transaction 2 executes as follows:
a. When startTransaction(2) is invoked, Integration Server starts a new, nested transaction.
b. When interactWithResourceB and interactWithResourceC are invoked, both resources are enlisted in transaction 2.
c. When commitTransaction(2) is invoked, the connections to ResourceB and ResourceC are closed, and transaction 2 is committed. At this point, only the work done on ResourceB and ResourceC is committed; transaction 1 is still open, and the work done with ResourceA is not yet committed.
3. When the flow ends, Integration Server closes the connection for transaction 1 and commits its work to ResourceA.