8.3.4 Develop Micronaut Apps with Saga

You can integrate the MicroTx library files with Micronaut applications that use the Saga transaction protocol.

For reference information about the MicroTx library for Micronaut applications, see Oracle® Transaction Manager for Microservices Micronaut API Reference for Saga.

To integrate the MicroTx library files with your Micronaut applications:

  1. Include the MicroTx Java library file as a maven dependency in the Micronaut application's pom.xml file. The following sample code is for the 24.4 release. Provide the correct version, based on the release version that you want to use.
    <dependency>
         <groupId>com.oracle.microtx.lra</groupId>
         <artifactId>microtx-lra-micronaut</artifactId>
         <version>24.4</version>
    </dependency>
  2. Specify values for the MicroTx library properties in the application.properties file of your application. This enables the custom library to establish communication with the MicroTx Saga coordinator, participate in Saga transactions, and propagate the relevant headers for the coordinated transactions. See Configure MicroTx Library Properties for Java Apps.
  3. Import the com.oracle.microtx.lra.annotation.* package.
    import com.oracle.microtx.lra.annotation.*
Source code of a sample Micronaut transaction initiator application which uses the MicroTx library is available in the trip-manager-micronaut folder in the microtx-samples GitHub repository. Source code of a sample Micronaut transaction participant application which uses the MicroTx library is available in the flight-micronaut folder in the microtx-samples GitHub repository. You can use these files as a reference while integrating the MicroTx libraries with your application.