webMethods Adapter Runtime 10.7 | webMethods Adapter Runtime Documentation | webMethods Adapter Runtime User’s Documentation | Transaction Management | Explicit Transactions | Explicit Transaction Usage Cases | One XAResource Transaction and One Nested Local and XAResource Transaction
 
One XAResource Transaction and One Nested Local and XAResource Transaction
The following flow includes two transactions: one XAResource transaction that interacts with two resources, and one nested transaction that interacts with one local resource and one XAResource.
BEGIN FLOW // start XAResource transaction 1
INVOKE interactWithXAResourceA // service for XAResource transaction 1
INVOKE interactWithXAResourceB // service for XAResource transaction 2

INVOKE startTransaction(2) // start transaction 2
INVOKE interactWithLocalResourceA // service for transaction 2
INVOKE interactWithXAResourceC // service for transaction 2
INVOKE interactWithLocalResourceA // service for transaction 2
INVOKE commitTransaction(2) // commit transaction 2

END FLOW // commit XAResource transaction 1
The flow executes as follows:
1. When interactWithResourceA is invoked, Integration Server starts an XAResource transaction 1 and enlists ResourceA.
2. When interactWithResourceB is invoked, Integration Server enlists ResourceB in transaction 1.
3. Transaction 2 is executed as follows:
a. When startTransaction(2) is invoked, Integration Server starts a new, nested transaction.
b. When interactWithLocalResourceA is invoked, LocalResourceA is enlisted in transaction 2.
c. When interactWithXAResourceC is invoked, XAResourceC is enlisted in transaction 2.
d. When interactWithLocalResourceA is invoked, LocalResourceA is enlisted in transaction 2.
e. When commitTransaction(2) is invoked, the connection to both resources of transaction 2 is closed, and transaction 2 is committed. At this point, only the work done on LocalResourceA and XAResourceC is committed; transaction 1 is still open, and the work done with XAResourceA and XAResourceB is not yet committed.
4. When the flow ends, Integration Server closes the connection for transaction 1 and commits its work to XAResourceA and XAResourceB.