This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k-examples.git
The following commit(s) were added to refs/heads/main by this push: new 894b2d0 chore: backport saga fix 894b2d0 is described below commit 894b2d0927c2aa8d3e31e01a6e5ece481286dbb8 Author: Pasquale Congiusti <pasquale.congiu...@gmail.com> AuthorDate: Thu Dec 15 10:48:03 2022 +0100 chore: backport saga fix from https://github.com/apache/camel-k/pull/3883 --- generic-examples/saga/Flight.java | 4 +++- generic-examples/saga/Payment.java | 6 ++++-- generic-examples/saga/README.md | 8 ++++---- generic-examples/saga/Train.java | 4 +++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/generic-examples/saga/Flight.java b/generic-examples/saga/Flight.java index 5aacbd9..76ac541 100644 --- a/generic-examples/saga/Flight.java +++ b/generic-examples/saga/Flight.java @@ -31,7 +31,9 @@ public class Flight extends RouteBuilder { rest("/api").post("/flight/buy") .param().type(RestParamType.header).name("id").required(true).endParam() - .route() + .to("direct:buy"); + + from("direct:buy") .saga() .propagation(SagaPropagation.MANDATORY) .option("id", header("id")) diff --git a/generic-examples/saga/Payment.java b/generic-examples/saga/Payment.java index 7eade73..b8e606e 100644 --- a/generic-examples/saga/Payment.java +++ b/generic-examples/saga/Payment.java @@ -31,7 +31,9 @@ public class Payment extends RouteBuilder { rest("/api/").post("/pay") .param().type(RestParamType.query).name("type").required(true).endParam() .param().type(RestParamType.header).name("id").required(true).endParam() - .route() + .to("direct:pay"); + + from("direct:pay") .saga() .propagation(SagaPropagation.MANDATORY) .option("id", header("id")) @@ -45,4 +47,4 @@ public class Payment extends RouteBuilder { from("direct:cancelPayment") .log("Payment #${header.id} has been cancelled"); } -} +} \ No newline at end of file diff --git a/generic-examples/saga/README.md b/generic-examples/saga/README.md index 56ba1f4..8b850eb 100644 --- a/generic-examples/saga/README.md +++ b/generic-examples/saga/README.md @@ -15,14 +15,14 @@ kubectl apply -f lra-coordinator.yaml * Start the three demo services ``` -kamel run -d camel-lra Payment.java -kamel run -d camel-lra Flight.java -kamel run -d camel-lra Train.java +kamel run -d camel:lra Payment.java +kamel run -d camel:lra Flight.java +kamel run -d camel:lra Train.java ``` * Start the saga application ``` -kamel run -d camel-lra Saga.java +kamel run -d camel:lra -d camel:direct Saga.java ``` Then you can use ```kamel logs saga``` to check the output of the transactions. diff --git a/generic-examples/saga/Train.java b/generic-examples/saga/Train.java index b46704d..1b42015 100644 --- a/generic-examples/saga/Train.java +++ b/generic-examples/saga/Train.java @@ -31,7 +31,9 @@ public class Train extends RouteBuilder { rest("/api/").post("/train/buy/seat") .param().type(RestParamType.header).name("id").required(true).endParam() - .route() + .to("direct:buySeat"); + + from("direct:buySeat") .saga() .propagation(SagaPropagation.SUPPORTS) .option("id", header("id"))