6 Develop Applications with XA
To use Transaction Manager for Microservices (MicroTx) to manage the transactions of your microservices, you need to make a few changes to your existing application code to integrate the functionality provided by the MicroTx libraries.
The MicroTx library is available for Java, Node.js, ORDS, Tuxedo, and WebLogic Server apps. See Supported Languages and Frameworks.
- Before you begin, ensure that you have installed the MicroTx transaction coordinator and you can access it. See Access MicroTx.
- Include the MicroTx client libraries in your microservice implementation.
- Use CDI annotations or MicroTx client libraries APIs to register the required interceptors and callbacks.
- Use CDI annotations or MicroTx client library APIs in participant microservices to obtain the connection to their XA compliant resource manager.
- Use MicroTx client libraries API to delineate transaction boundaries indicating an XA transaction has started, and then commit or roll back the transaction.
Use the following workflow as a guide to develop your applications to use MicroTx to manage XA transactions.
Task | Description | More Information |
---|---|---|
Set up resource manager for your transaction participant applications | Identify the type of resource manager that you want to use, such as XA-compliant or non-XA compliant. | Plan Your Resource Manager |
Provide configuration information for the MicroTx library properties. | Perform this step for all the transaction participant and transaction initiator applications so that your applications can access the library. | Configure Library Properties |
Integrate MicroTx library with your application code. | Select a suitable procedure to integrate the library based on the following factors:
|
Based on your app, perform one of the following tasks: |
Deploy your application | Develop, test, and deploy your microservices independently. After using the library files in your application, the application in your environment. | Deploy Your Application |
- Plan Your Resource Manager
Consider the points discussed in this section to plan the resource manager. Based on the resource manager that you select and how you use it, the configuration requirements varies for your application. - Provide the Resource Manager Connection Details
For every transaction participant application that uses a resource manager to store the application data, enter the connect string, user name, and password to access the resource manager in the application'sYAML
file. Skip this section if your application does not use a resource manager. - Configure PostgreSQL as Resource Manager
To use PostgreSQL as resource manager for XA transactions, you must enable prepared transactions and session affinity. - Manage XA Transactions
- Required User Privileges
You must have the following privileges to execute an XA transaction. - Configure Library Properties
Provide configuration information for the MicroTx library properties for JAX-RS, Spring REST, and Node.js applications. Specify the library property values for both participant and initiator applications. - About @Transactional
You can configure your Java applications that use the XA transaction protocol in two distinct ways. - Develop Spring REST Apps with XA
Use the MicroTx library with your Spring REST applications. - Develop JAX-RS Apps with XA
Use the MicroTx library with your JAX-RS applications. - Configure Java Apps to Leverage Transactional Event Queues
Integrate Oracle MicroTx library with your application to leverage the Oracle Transactional Event Queues (TEQ) feature. - Develop Node.js Apps with XA
- Develop ORDS App with XA
Configure an Oracle Database application, that you have built using Oracle APEX and Oracle REST Data Services (ORDS), as a transaction initiator or participant in an XA transaction with MicroTx.