Search code examples
wildflymicroprofileeclipse-microprofile-config

MicroProfile LRA on Wildfly - How to setup LRA coordinator host and port on client application runing on WildFly


I have introduced LRA on a MicroProfile application already running on WildFly AS.

To get the LRA working I have added the following depedency on my application pom.xml

<dependency>
    <groupId>org.jboss.narayana.rts</groupId>
    <artifactId>narayana-lra</artifactId>
    <version>5.10.6.Final</version>
</dependency>

and I have created an LRA coordinator running on the same host ad listening on port 8080.

The application works as expected.

Now I want to move LRA coordinator on a remote host, but I'm not able to configure my application to point to it (on new host and port).

I have tried to put in my microprofile-config.properties the following parameters:

mp.lra.http.host=<new_host>

mp.lra.http.port=<new_port>

but without effect.

Can anyone suggest me hot to configure LRA coordinator host and port on client application?

Thanks in advance


Solution

  • Narayana doesn't support MicroProfile Config yet even if it is something that it probably should. The properties you want to set are defined only as system properties (i.e., read with System.getProperty(String, String).

    Another issue is that the properties you are looking for are defined as lra.http.host and lra.http.port respectively. MP LRA made a deliberate decision to remove all coordinator references from the specification to not specify the implementation architectures (saga can also be implemented as an orchestration pattern).

    So you need to set these system properties for instance when you are starting the WildFly server:

    bin/standalone.sh -Dlra.http.host=lra-coordinator.com -Dlra.http.port=7777
    

    Finally, if you ever move to the latest Narayana releases, these properties were merged only into single property lra.coordinator.url which is however still read only from system properties.