8.4.1 Configure Library Properties for Node.js Apps
Provide configuration information for the MicroTx library properties. You must perform this step for all the Node.js applications which participate or initiate the transaction.
tmm.properties
file in any code editor, and then enter values for the following parameters to configure the MicroTx library.-
oracle.tmm.TcsUrl
: 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. oracle.tmm.CallbackUrl
: 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:
Where,https://externalHostnameOfApp:externalPortOfApp/
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 initiator or participant service remotely. For example,8081
.
-
oracle.tmm.PropagateTraceHeaders
: Set this totrue
when you want to trace the transaction from end-to-end. This propagates the Saga context headers through non-LRA endpoints for all incoming and outgoing requests. This ensures proper coordination with other Saga participants.
oracle.tmm.TcsUrl = https://192.0.2.1:443/api/v1/lra-coordinator
oracle.tmm.CallbackUrl = https://bookTicket-app:8081
oracle.tmm.PropagateTraceHeaders = true
You can use the HTTP protocol if your application and MicroTx are in the same Kubernetes cluster, otherwise use the HTTPS protocol.
You can also provide these configuration values as environment variables. Note that if you specify values in both the properties file as well as the environment variables, then the values set in the environment variables override the values in the properties file.
The following example provides sample values to configure the environment variables.
export ORACLE_TMM_TCS_URL = http://tmm-app:9000/api/v1
export ORACLE_TMM_CALLBACK_URL = http://bookTicket-app:8081
export ORACLE_TMM_PROPAGATE_TRACE_HEADERS = true
Note that the environment variables names are case-sensitive.
Parent topic: Develop Node.js Apps with Saga