7.2.1 Configure MicroTx Library Properties for Java Apps

Provide configuration information for the MicroTx library properties. You must perform this step for all Micronaut and Spring REST-based apps which participate or initiate the transaction and use the MicroTx library.

Do not perform this step for JAX-RS or Helidon apps as these apps do not use the MicroTx library.

Configure the following properties in the application.properties file of your Micronaut or Spring REST-based application. This enables the custom library to establish communication with the MicroTx Saga coordinator, participate in Saga transactions, and propagates the relevant headers for the coordinated transactions.

  • microtx.lra.coordinator-url for Micronaut apps or spring.microtx.coordinator-url for Spring REST-based apps: Enter the URL to access the MicroTx Saga coordinator. This permits the MicroTx library to communicate and coordinate transactions with the coordinator. To get the URL, append /lra-coordinator to the URL to access MicroTx. For example, https://192.0.2.1:443/api/v1/lra-coordinator. For information to identify the URL to access MicroTx, see Access MicroTx. You must enter this value for the transaction initiator application. You don't have to specify this value for the transaction participant applications.

  • microtx.lra.propagation-active for Micronaut apps or spring.microtx.lra.propagation-active for Spring REST apps: Set this to true when you want to trace the transaction from end-to-end. This propagates the Saga context headers for all incoming and outgoing requests. This ensures proper coordination with other Saga participants.
  • microtx.lra.participant-url for Micronaut apps or spring.microtx.lra.participant-url for Spring REST apps: Enter the URL of your participant service associated with the MicroTx client library. MicroTx uses the URL that you provide to connect to the participant service. Provide this value in the following format:

    https://externalHostnameOfApp:externalPortOfApp/
    Where,
    • externalHostnameOfApp: The external host name of your initiator or participant service. For example, bookTicket-app.
    • externalPortOfApp: The port number over which you can access your participant service remotely. For example, 8081.
    You must specify this value for the transaction participant applications. You don't have to specify this value for the transaction initiator application.
  • microtx.lra.headers-propagation-prefix for Micronaut apps or spring.microtx.lra.headers-propagation-prefix for Spring REST apps: Specify a list of prefixes that you want to propagate in the header from the incoming requests to the outgoing requests within the custom library. For example, trace headers, authorization headers, and custom MicroTx headers. This ensures that necessary information is preserved during transactions as the specified prefixes are included as headers in the context of the propagated Saga transaction.
  • microtx.lra.lock-free-reservation-active for Micronaut apps or spring.microtx.lra.lock-free-reservation-active for Spring-REST based apps: Set this to true to enable the MicroTx coordinator use the lock-free reservation feature provided in Oracle Database 23ai. When you set this value to true, MicroTx manages the lock-free reservation interaction and also injects and propagates the Long-Running-Action-Sagaid header across the participants and coordinator calls. Do not provide a value for this property if your application does not use lock-free reservation.
  • spring.microtx.lra.retry-max-attempts for Spring REST apps: Specify the maximum number of times that the application retries sending a request to the MicroTx coordinator in case of any failures. For example, 15. The default value is 10.
  • spring.microtx.lra.retry-max-delay for Spring REST apps: The maximum retry interval, in milliseconds, before which the application retries sending the same request again to the MicroTx coordinator in case of any failures. For example, 2000. The default value is 1000 milliseconds.

Sample property values for Spring REST-based apps

spring.microtx.lra.coordinator-url=http://tmm-app:9000/api/v1/lra-coordinator
spring.microtx.lra.propagation-active=true
spring.microtx.lra.participant-url=http://bookTicket-app:8081
spring.microtx.lra.headers-propagation-prefix = {x-b3-, oracle-tmm-, authorization, refresh-}
spring.microtx.lra.retry-max-attempts=15
spring.microtx.lra.retry-max-delay=2000

Sample property values for Micronaut apps

microtx.lra.coordinator-url=http://tmm-app:9000/api/v1/lra-coordinator
microtx.lra.propagation-active=true
microtx.lra.participant-url=http://bookTicket-app:8081
microtx.lra.headers-propagation-prefix = {x-b3-, oracle-tmm-, authorization, refresh-}

You can use the HTTP protocol if your application and MicroTx are in the same Kubernetes cluster, otherwise use the HTTPS protocol.