forked from apache/camel-k
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix apache#1304: fix the saga example to use default ports
- Loading branch information
1 parent
a2f9629
commit 4037ad2
Showing
7 changed files
with
127 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,48 @@ | ||
# Saga example | ||
This example is from [camel-saga-quickstart](https://github.com/nicolaferraro/camel-saga-quickstart/) and could work with the camel-k. | ||
|
||
* Start the lra-coordinator by using the openshift | ||
This example is from [camel-saga-quickstart](https://github.com/nicolaferraro/camel-saga-quickstart/) adapted to work with camel-k. | ||
|
||
Make sure Camel K is installed in your namespace, or execute the following command to install it: | ||
|
||
``` | ||
oc create -f lra-coordinator.yaml | ||
kamel install | ||
``` | ||
* Or start the lra-coordinator by using the kubernetes | ||
|
||
* Start the lra-coordinator by using the `oc` or `kubectl` tool: | ||
``` | ||
kubectl create -f lra-coordiantor-kub.yaml | ||
kubectl apply -f lra-coordinator.yaml | ||
``` | ||
|
||
* Start the three demo services | ||
``` | ||
kamel run -t container.service-port=8080 --dependency=camel-rest --dependency=camel-undertow --dependency=camel-lra examples/saga/Flight.java | ||
kamel run -t container.service-port=8080 --dependency=camel-rest --dependency=camel-undertow --dependency=camel-lra examples/saga/Train.java | ||
kamel run -t container.service-port=8080 --dependency=camel-rest --dependency=camel-undertow --dependency=camel-lra examples/saga/Payment.java | ||
kamel run -d camel-undertow -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 -t container.service-port=8080 --dependency=camel-rest --dependency=camel-undertow --dependency=camel-lra examples/saga/Saga.java | ||
kamel run -d camel-lra -t service.auto=false Saga.java | ||
``` | ||
|
||
Then you can use ```kamel logs saga``` to check the output of the transactions. | ||
|
||
Focusing on one of the services, e.g. the flight service, you will notice that when unexpected events are found, | ||
the operation is subsequently cancelled, e.g.: | ||
|
||
E.g. running: | ||
``` | ||
kamel logs flight | ||
``` | ||
|
||
Possible workflow: | ||
``` | ||
flight-7c8df48b88-6pzwt integration 2020-03-02 10:56:30.148 INFO [default-workqueue-2] route2 - Buying flight #18 | ||
flight-7c8df48b88-6pzwt integration 2020-03-02 10:56:30.165 ERROR [XNIO-1 I/O-1] DefaultErrorHandler - Failed delivery for (MessageId: ID-flight-7c8df48b88-6pzwt-1583146351094-0-106 on ExchangeId: ID-flight-7c8df48b88-6pzwt-1583146351094-0-105). Exhausted after delivery attempt: 1 caught: org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://payment/api/pay?bridgeEndpoint=true&type=flight with statusCode: 500 | ||
... | ||
# after stacktrace | ||
... | ||
flight-7c8df48b88-6pzwt integration 2020-03-02 10:56:30.256 INFO [XNIO-2 task-6] route1 - Flight purchase #18 has been cancelled | ||
flight-7c8df48b88-6pzwt integration 2020-03-02 10:56:35.150 INFO [default-workqueue-3] route2 - Buying flight #19 | ||
flight-7c8df48b88-6pzwt integration 2020-03-02 10:56:35.197 INFO [XNIO-1 I/O-1] route2 - Payment for flight #19 done | ||
``` | ||
Then you can use ```kamel log saga``` to check the output of the transactions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.