This demo including three services:
- servicea
- serviceb
- servicec
You will need:
-
run the following command to create docker images in saga project root folder.
mvn clean install -DskipTests -Pdocker -Pdemo
-
start the whole application up(including alpha server and three demo services)
./saga-dubbo-demo.sh up
Note: If you prefer to use MySQL as alpha's backend database, you need to try the following steps instead:
- add dependency of
mysql-connector-java
inalpha/alpha-server/pom.xml
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency>
- re-generate saga's docker images in saga project root folder
mvn package -DskipTests -Pdocker -Pdemo
- start application up in
saga-dubbo-demo
with the following command
cd ./saga-demo/saga-dubbo-demo ./saga-dubbo-demo.sh up-mysql
Note: If you want start alpha server and demon services separately, you can try the following steps:
- start alpha server
./saga-dubbo-demo.sh up-alpha
- when alpha server started complatelly, then start the demo services
./saga-dubbo-demo.sh up-demo
- add dependency of
-
stop application
./saga-dubbo-demo.sh down
Use browser to run transaction demos: A:servicea B:serviceb C:servicec
A->B
http://${host_address}:8071/serviceInvoke/Ab
A->B (A throw an exception)
http://${host_address}:8071/serviceInvoke/AExceptionWhenAb
A->B (B throw an exception)
http://${host_address}:8071/serviceInvoke/BExceptionWhenAb
A->B A->C
http://${host_address}:8071/serviceInvoke/AbAc
A->B A->C (C throw an exception)
http://${host_address}:8071/serviceInvoke/CExceptionWhenAbAc
A->B B->C
http://${host_address}:8071/serviceInvoke/AbBc
A->B B->C (C throw an exception)
http://${host_address}:8071/serviceInvoke/CExceptionWhenAbBc
Take the spring-demo debugging as a reference.