The data integration feature in the ESB profile of WSO2 EI supports data federation, which means that a single data service can expose data from multiple datasources. However, if you have multiple RDBMSs connected to your data service, and if you need to perform IN-ONLY operations (operations that can insert data and modify data in the datasource) in a coordinated manner, the RDBMSs need to be defined as XA datasources.
...
Start the WSO2 ESB profile.
Panel borderColor #542989 bgColor #ffffff borderWidth 1 Localtabgroup Localtab active true title On MacOS/Linux/CentOS Open a terminal and execute the following command:
Code Block sudo wso2ei-6.45.0-integrator
Localtab title On Windows Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.45.0 Integrator. This will open a terminal and start the ESB profile. - Access the management console of the ESB profile:
https://localhost:9443/carbon
- Sign in using
admin
as the username and password. - On the Data Service menu click Create.
- Add a name for the data service and click Next.
Select the Enable Boxcarring and Disable Legacy Boxcarring Mode check boxes.
Note title What is Boxcarring and Request Box? Boxcarring is a method of grouping a set of service calls so that they can be executed as a group (i.e., the individual service calls will be executed consecutively in the specified order). Note that we have now deprecated the boxcarring method for data services. Instead, we have replaced boxcarring with a new request type called request_box.
Request box is simply a wrapper element (request_box), which wraps the service calls that need to be invoked. When the request_box is invoked, the individual service calls will be executed in the specified order, and the result of the last service call in the list will be returned. In this tutorial, we are using the request box to invoke the following two service calls:
- Add a new employee to the database
- Get details of the office of the added employee
When you click the Enable Boxcarring check box for the data service, both of the above functions (Boxcarring and Request box) are enabled. However, since boxcarring is deprecated in the product, it is recommended to disable boxcarring by clicking the Disable Legacy Boxcarring Mode check box.
- Click Next to go to the Datasources screen.
Click Add New Datasource to create a datasource connection for the OfficeDetails database:
Datasource Id Enter XAoffices as the datasource ID. Datasource Type Select RDBMS as the datasource type and s elect External Datasource from the adjoining field.
Database Engine Select MySQL.
Datasource Class Name Enter the database class that corresponds to
MysqlXADataSource.class
.
Example: For MySQL 5, entercom.mysql.jdbc.jdbc2.optional.MysqlXADataSource
Tip Make sure to check the path of the
MysqlXADataSource.class
and enter the updated path here. Else, you run into errors.Add New Property Specify the following connection settings for the OfficeDetails database:
Property Name Value url
jdbc:mysql://localhost:3306/OfficeDetails
user
Enter your MySQL server's username.
Example: rootpassword
Optionally: Enter your MySQL server's password.
If you have not assigned a password, do not add this property.Example: The New Datasource screen will now look as follows:
- Save the XAoffices datasource.
Click Add New Datasource to create a datasource connection for the EmployeeDetails database as follows:
Datasource Id Enter XAemployees as the datasource ID. Datasource Type Select RDBMS as the datasource type and select External Datasource from the adjoining field.
Database Engine Select MySQL.
Datasource Class Name Enter the database class that corresponds to
MysqlXADataSource.class
.
Example: For MySQL 5, entercom.mysql.jdbc.jdbc2.optional.MysqlXADataSource
.Tip Make sure to check the path of the
MysqlXADataSource.class
and enter the updated path here. Else, you run into errors.Add New Property Specify the following connection settings for the EmployeeDetails database:
Property Name Value url
jdbc:mysql://localhost:3306/EmployeeDetails
user
Enter your MySQL server's username.
Example: rootpassword
Optionally:Enter your MySQL server's password.
If you have not assigned a password, do not add this property.Example: The New Datasource screen now look as follows:
- Save the XAemployees datasource and click Next.
...