[Download] | [Documentation Home] | [Release Note]
Distributed transactions are important when need to handle multiple transactions across multiple databases in a coordinated way. In this sample, We demonstrate the distributed transactions support in WSO2 Data Services Server.
The sample data services should be deployed as per the instructions mentioned in Deploying Samples section.
The sample service "DTPSampleService", can be run using the "tryit" tool, which is bundled with WSO2 Data Services Server, or a code-generated java client sample using this service is demonstrated in the Data Services Clients Sample section.
The scenario is based on a two separate banks which use two separate databases where distributed transactions get involves when doing bank transactions(transfer of money) between two accounts of different banks.
This service has used "distributed transactions with multiple data source" support. The usage of distributed transactions can be demonstrated by executing the following operations using the "tryit" tool.
Figure 1: Add account to bank1.
Figure 2: Add account to bank2.
Figure 3: Get account balance from bank1.
Figure 4: Get account balance from bank2.
As we can see, "addAccountToBank1" service call also rolled back because of the error in "addAccountToBank2" operation.