LRA Coordinator with specific headers

86 views
Skip to first unread message

Mustafa Asaad

unread,
Apr 27, 2023, 1:04:19 PM4/27/23
to narayana-users
Hi All,

First i would like to apologize for the lack of knowledge that i am having right now, i feel so overwhelmed and dont know where to look for such info.

As a starter i have 2 microservices using KeyCloak

i m  currently running Narayana LRA Coordinator on port 8080, and running service x on port 8000, service y on port port 8082.
Saga is as follows ...
new saga in service x, then route book1 at service x, then route book2 at service y.
and on saga completed i have a route in service x when the Saga is completed which logs a specific message.
but Coordinator on  completing getting error.
i believe  because i have missing Auth & headers which is required on x & y it is returning this error.
is there a way to make this work by adding the required headers to Narayana so it can send back with other requests ? or do i have to extend the current source ?

i already have the headers in Camel Headers, but its removed from the coordinator somehow or it is not saving them.

Narayana LRA running on docker pulled from here:
https://quay.io/repository/jbosstm/lra-coordinator

Also i have downloaded Narayana Source Code, how can i build and run it locally?

Any help would be highly appreciated
Thank you

Martin Stefanko

unread,
Apr 28, 2023, 2:18:35 AM4/28/23
to narayana-users
Hi Mustafa,

this is totally possible. The coordinator is making a normal HTTP call to participants to invoke completions/compensations. If you could share the error message, then we can say for sure.

We can add this functionality, but I believe currently, only the LRA coordinator itself can be secured.

Cheers,
Martin

Mustafa Asaad

unread,
Apr 28, 2023, 2:42:12 AM4/28/23
to narayana-users

Hi Martin, 
thank you for taking time to answer.
the error is connection refused, and  when i disable keyCloak on my services completion/compensations work perfectly.

so i was thinking since the source code is already available, may be i can extend it and add the headers to it ?
also regarding this "Also i have downloaded Narayana Source Code, how can i build and run it locally?" is there an easy answer  xD? 

Cheers,
Mustafa

Marco Sappe Griot

unread,
Apr 28, 2023, 4:07:24 AM4/28/23
to narayana-users
Hi Mustafa,
regarding your question about building and running it locally you can follow the READMEs: 
For your use case you can build it like: ./build.sh clean install -DskipTests -Pcommunity
However if you want an easy way to start a standalone Narayana LRA coordinator I would suggest you to have a look at our quickstart: i.e. https://github.com/jbosstm/quickstart/tree/main/rts/lra-examples/lra-coordinator

Kind regards,
Marco

Martin Stefanko

unread,
Apr 28, 2023, 4:13:46 AM4/28/23
to narayana-users
Such a contribution to Narayana would certainly be welcomed! Don't hesitate to reach out if you run into any problems.

Cheers,
Martin

Mustafa Asaad

unread,
May 10, 2023, 9:40:16 AM5/10/23
to narayana-users

Hi Again, 

if you could excuse me i am just starting with Java development (previously .Net core), my current objective is to extend the LRA coordinator by adding custom headers that i need.


fyi : i am using Mac & Intellij 

the steps i have done, is:-

1- downloading the Narayan Repo with lastest commits  

2- building the LRA coordinator Module using this command written in the readme 

                LRA: ./build.[sh|bat] -am -f rts/lra

3- the build generated jar and war files 

4- when i try to run them locally

java -jar ~/IdeaProjects/narayana/rts/lra/coordinator-war/target/lra-coordinator.war

i get this :-

no main manifest attribute, in ~/IdeaProjects/narayana/rts/lra/coordinator-war/target/lra-coordinator.war

which i know it means there is no main class for running this ..


what i am trying  to do here is to run the LRA coordinator locally & if possible to try to run it in Intellij so i can debug and trace calls from/to it


thank you 

Martin Stefanko

unread,
May 11, 2023, 4:32:40 AM5/11/23
to narayana-users
Hi Mustafa,

no worries, we've all had to start somewhere.

WAR (web archive) in Java is not a runnable format. It's an artifact that you can deploy to an application server, for instance, WildFly.

$ unzip wildfly-28.0.0.Final.zip
$ wildfly-28.0.0.Final/bin/standalone.sh

Now you have running WildFly in standalone mode.

In a different terminal, open your Narayana repository:

$ cp coordinator-war/target/lra-coordinator.war /path/to/wildfly-28.0.0.Final/standalone/deployments
Replace /path/to/ with actual path to the server you ran in the first step.

Now you deployed lra-coordinator.war to the WildFly application server and it runs on localhost:8080/lra-coordinator.

You can verify with for instance curl like this:

$ curl localhost:8080/lra-coordinator/lra-coordinator  
[]% 

Another way, is to clone https://github.com/jbosstm/lra-coordinator-quarkus which is distributed as runnable jar. Build that project with `mvn clean package` and you can run the coordinator with `java -jar target/quarkus-app/quarkus-run.jar`. If you want to change something in narayana and use quarkus distribution, update the narayana version here - https://github.com/jbosstm/lra-coordinator-quarkus/blob/main/pom.xml#L11 to your snapshot version that you build with narayana.

Cheers,
Martin
Reply all
Reply to author
Forward
0 new messages