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.git
The following commit(s) were added to refs/heads/main by this push:
new f2b0207a3 Fix #3869: Update Saga Example
f2b0207a3 is described below
commit f2b0207a37b4b824ce3e58bdd26606150248bca8
Author: Ocimar <[email protected]>
AuthorDate: Wed Dec 7 11:36:32 2022 -0300
Fix #3869: Update Saga Example
---
examples/saga/Flight.java | 4 +++-
examples/saga/Payment.java | 4 +++-
examples/saga/README.md | 2 +-
examples/saga/Train.java | 4 +++-
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/examples/saga/Flight.java b/examples/saga/Flight.java
index 5aacbd92d..76ac54192 100644
--- a/examples/saga/Flight.java
+++ b/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/examples/saga/Payment.java b/examples/saga/Payment.java
index 7eade73b0..07f511058 100644
--- a/examples/saga/Payment.java
+++ b/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"))
diff --git a/examples/saga/README.md b/examples/saga/README.md
index 91f0ac130..8b850ebec 100644
--- a/examples/saga/README.md
+++ b/examples/saga/README.md
@@ -22,7 +22,7 @@ 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/examples/saga/Train.java b/examples/saga/Train.java
index b46704d05..1b42015ba 100644
--- a/examples/saga/Train.java
+++ b/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"))