3 Prerequisites

Before you begin, download the Transaction Manager for Microservices (MicroTx) installation bundle to your local system.

If you plan to run XA sample application, set up the resource managers for the transaction participant services.

3.1 Download the Installation Bundle

Perform the following steps to download the MicroTx installation bundle to your local system:

  1. Download the MicroTx installation bundle (.zip file) from https://www.oracle.com/database/transaction-manager-for-microservices/.
  2. Unzip the MicroTx installation bundle.
    unzip otmm-<version>.zip
  3. Run the following command to view the list of files that are extracted.
    ls -lR otmm-<version>

The following folders are available.

  • lib: This folder contains the MicroTx library files. You must use these library files in your application code to use MicroTx to manage transactions amongst your application microservices.
  • otmm: This folder contains the MicroTx image and YAML files which you can use to install and configure MicroTx.
  • console: This folder contains the image file for the MicroTx console.

3.2 Clone the Sample Code Files

Clone the sample application files from the git repo to your local system.

  1. Clone the git repo from https://github.com/oracle-samples/microtx-samples.
  2. View the available files and folders.
This contains the source code for sample applications for different transaction protocols: XA, Saga, and TCC.

3.3 Set Up XA-Compliant Resource Managers

If you want to run sample applications that use the XA transaction protocol, then you must set up XA-compliant resource managers and create tables with sample values. Skip this step if you don't want to run sample applications that use XA.

You can use any Oracle Database. For example, Autonomous Transaction Processing (ATP) Database instances in Oracle Cloud, an Oracle Database running inside a Kubernetes cluster, or an on-premises database. Ensure that application, when it is deployed, can access the database.

Only if you use an Autonomous Database instance, perform the following steps to get the Oracle client credentials (wallet files):
  1. Download the wallet from the Autonomous Database instance. See Download Client Credentials (Wallets) in Using Oracle Autonomous Database on Shared Exadata Infrastructure.

    A ZIP file is downloaded to your local machine. Let's consider that the name of the wallet file is Wallet_database.zip.

  2. Unzip the wallet file.
    unzip Wallet_database.zip

    The files are extracted to a folder. Note down the location of the wallet file as you will have to provide this later.

Create database and tables with sample values

Run SQL script files to test the sample XA applications, create database and tables with sample values for both the department applications. The SQL script files are available in the microtx-samples GitHub repository. Run the SQL script using a client tool with which you connect to the database. To run the scripts, you must either be a database administrator or have the required privileges to create and run DMLs. You'll also need to provide database credentials to establish a connection with the database and run the SQL script.

To use the SQL script to create a database, a table, and populate it with sample values:

  1. Open the department.sql file in any code editor and replace <password> with the database administrator's password. This file is located in the xa/java/department-helidon folder in the microtx-samples GitHub repository.
  2. Run the department.sql file by connecting to Oracle Database using SQL developer or SQL plus.

    This creates a database with the name department_helidon and a table with the name accounts. It also populates the accounts table with sample values.

  3. Open the department.sql file in any code editor and replace <password> with the database administrator's password. This file is located in the xa/java/department-spring folder in the microtx-samples GitHub repository.
  4. Run the department.sql file by connecting to Oracle Database using SQL developer or SQL plus.

    This creates a database with the name department_spring and a table with the name accounts. It also populates the accounts table with sample values as provided in the following table.

    Account_ID Amount
    account1 1000
    account2 2000
    account3 3000
    account4 4000
    account5 5000