This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 5fb496ee418b CAMEL-24150: camel-lra - Fix REST participant routes not
binding to HTTP server
5fb496ee418b is described below
commit 5fb496ee418bd4275cd0e2149cbc0a71309b4db4
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jul 18 14:24:11 2026 +0200
CAMEL-24150: camel-lra - Fix REST participant routes not binding to HTTP
server
Move addRoutes(LRASagaRoutes) back to setCamelContext() so the REST DSL
participant endpoints are registered before CamelContext starts its routes.
When added in doStart() (via DeferServiceStartupListener which fires after
route startup), the REST endpoints were never bound to the HTTP server,
causing the LRA coordinator callback to get "Connection refused".
Also adds a README documenting how to run the LRA coordinator natively
for manual integration testing on platforms without Docker support.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
components/camel-lra/README.md | 75 ++++++++++++++++++++++
.../apache/camel/service/lra/LRASagaService.java | 14 ++--
2 files changed, 85 insertions(+), 4 deletions(-)
diff --git a/components/camel-lra/README.md b/components/camel-lra/README.md
new file mode 100644
index 000000000000..b235f0ebad11
--- /dev/null
+++ b/components/camel-lra/README.md
@@ -0,0 +1,75 @@
+# Running LRA Integration Tests Manually
+
+The LRA integration tests require a Narayana LRA coordinator.
+By default, the test infrastructure starts one via Docker (Testcontainers),
+but on platforms where the Docker image is unavailable (e.g. aarch64 Mac)
+you can run the coordinator natively and point the tests at it.
+
+## 1. Extract the coordinator from the Docker image
+
+```bash
+mkdir -p /tmp/lra-coordinator && cd /tmp/lra-coordinator
+
+# Pull the image and copy the Quarkus app out
+docker create --name lra-tmp
quay.io/jbosstm/lra-coordinator:5.13.1.Final-2.16.6.Final
+docker cp lra-tmp:/deployments/. .
+docker rm lra-tmp
+```
+
+## 2. Start the coordinator
+
+The coordinator listens on port 8080 by default.
+Use shortened recovery periods so failed participant callbacks are retried
+quickly (the Docker container uses the same settings):
+
+```bash
+cd /tmp/lra-coordinator
+
+java \
+ -Dcom.arjuna.ats.arjuna.recovery.periodicRecoveryPeriod=2 \
+ -Dcom.arjuna.ats.arjuna.recovery.recoveryBackoffPeriod=1 \
+ -jar quarkus-run.jar
+```
+
+Verify it is running:
+
+```bash
+curl -s http://localhost:8080/lra-coordinator
+# Should return [] (empty JSON array)
+```
+
+## 3. Run the tests
+
+The key system property to bypass Docker is
`microprofile-lra.instance.type=remote`
+(note the **dash** between `microprofile` and `lra`, not a dot).
+
+Run from the `components/camel-lra` directory:
+
+```bash
+cd components/camel-lra
+
+# Run all IT tests against the native coordinator
+mvn test \
+ -Dtest="LRAManualIT,LRAFailuresIT" \
+ -Dmicroprofile-lra.instance.type=remote \
+ -Dmicroprofile.lra.host=localhost \
+ -Dmicroprofile.lra.port=8080 \
+ -Dmicroprofile.lra.service.address=http://localhost:8080
+```
+
+### System properties reference
+
+| Property | Description | Default |
+|---|---|---|
+| `microprofile-lra.instance.type` | Set to `remote` to skip Docker and use an
external coordinator | `local-microprofile-lra-container` (Docker) |
+| `microprofile.lra.host` | Coordinator hostname | `localhost` |
+| `microprofile.lra.port` | Coordinator port | `8080` |
+| `microprofile.lra.service.address` | Full coordinator base URL |
`http://<host>:<port>` |
+| `microprofile.lra.callback.host` | Host the coordinator uses to call back to
the test JVM | `localhost` |
+
+### Property name gotcha
+
+The instance-type property uses a **dash** (`microprofile-lra.instance.type`),
+matching the service name in `SimpleTestServiceBuilder`.
+The other properties use **dots** (`microprofile.lra.*`).
+Using the wrong separator silently falls back to Docker mode.
diff --git
a/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
b/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
index d7ef791feb75..73552c994ffb 100644
---
a/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
+++
b/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
@@ -92,10 +92,6 @@ public class LRASagaService extends ServiceSupport
implements StaticService, Cam
throw new IllegalStateException("localParticipantUrl must be
configured on the LRA saga service");
}
- if (this.routes == null) {
- this.routes = new LRASagaRoutes(this);
- camelContext.addRoutes(this.routes);
- }
if (this.executorService == null) {
this.executorService = camelContext.getExecutorServiceManager()
.newDefaultScheduledThreadPool(this, "saga-lra");
@@ -130,6 +126,16 @@ public class LRASagaService extends ServiceSupport
implements StaticService, Cam
@Override
public void setCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
+ // Routes must be added here (not in doStart) so they are registered
before CamelContext
+ // starts its routes — otherwise the REST DSL endpoints won't bind to
the HTTP server.
+ if (this.routes == null) {
+ this.routes = new LRASagaRoutes(this);
+ try {
+ this.camelContext.addRoutes(this.routes);
+ } catch (Exception ex) {
+ throw RuntimeCamelException.wrapRuntimeException(ex);
+ }
+ }
}
@Override