How to use Narayana-lra server with GenericContainer
?
#5107
-
Hello! I hope this request is in the right place. It would be great to have a TestContainer that spins up a narayana-lra server for testing LRA functionalities. It appears that we would need to either create a barebones quarkus app to containerize to be the server, or use a standalone binary. Otherwise looks fairly straightforward: https://jbossts.blogspot.com/2021/07/narayana-lra-update.html https://narayana.io/downloads/index.html Info on usage of Naraya: https://jbossts.blogspot.com/2021/07/how-to-use-long-running-actions-between.html |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hey @GregJohnStewart, thanks for letting us know. I'd assume this should be straightforward if there would be a Docker image for a narayana-lra server, then it might also work with our What about this image? This whole topic is outside of my expertise, so there is not much concrete I can advise on. |
Beta Was this translation helpful? Give feedback.
-
That container looks good to me, unfortunately I am also quite new to LRA, so I can't speak much to it either (I'm looking for the test container so I can play with it!) Outwardly it looks like a fairly simple service though |
Beta Was this translation helpful? Give feedback.
-
Given the sparse docs, you can try with the following new GenericContainer<>("jbosstm/lra-coordinator")
.withExposedPort(8080)
.waitingFor(Wait.forLogMessage(".*started in.*\\s", 1)) |
Beta Was this translation helpful? Give feedback.
-
Thanks! Seems to work well! |
Beta Was this translation helpful? Give feedback.
-
Cool, I will convert this into a GH Discussions Q&A (for hopefully better discoverability). |
Beta Was this translation helpful? Give feedback.
-
There is a caveat when it comes to Narayana calling back the participant. During the LRA workflow, Narayana should call an endpoint on each participant to tell if they should commit the ongoing tx or rollback. This requires the container to access a socket on the host (i.e. the process running the tests). To be able to do it, Narayana should call it using a special hostname -- http://host.testcontainers.internal (see) . Ports within this host must be made accessible by calling the |
Beta Was this translation helpful? Give feedback.
Given the sparse docs, you can try with the following
GenericContainer
(not tested):