13.1 About XA Sample Application
The sample XA application implements a scenario where a Teller application initiates an amount transfer from one department to another by creating an XA transaction. The two departments in the organization are Department One (Dept 1) and Department Two (Dept 2).
MicroTx implements the XA transaction. Within the XA transaction, all actions such as withdraw and deposit either succeed, or they all are rolled back in case of a failure of any one or more actions.
The following image shows a sample XA application deployment which consists of polyglot participant microservices.

- MicroTx coordinator manages transactions amongst the participant services.
- Teller microservice initiates the transactions, so it is called an XA transaction initiator service. The user interacts with this microservice to transfer money between departments One and Two. When a new request is created, the helper method that is exposed in the MicroTx library runs the
begin()
method for XA transaction to start the XA transaction at the Teller microservice. This microservice also contains the business logic to issue the XA commit and roll back calls. - Department One and Department Two participate in the transactions, so they are called as XA participant services. The MicroTx library includes headers that enable the participant services to automatically enlist in the transaction. These microservices expose REST APIs to get the account balance and to withdraw or deposit money from a specified account. They also use resources from resource manager.
Resource managers manage stateful resources such as databases, queuing or messaging systems, and caches.
The service must meet ACID requirements, so an XA transaction is initiated and both withdraw and deposit are called in the context of this transaction.
The next topic describes how the microservices and MicroTx communicate during an XA transaction.
- Scenario: Withdraw and Deposit an Amount
The following steps describe an example sequence for the successful path of an XA transaction when you run the sample application. Let us consider a scenario, where a user places a request to withdraw an amount from Department One and deposit that amount into Department Two. In case of failures, the initiating application calls a rollback instead of a commit.
Parent topic: Deploy Sample Applications