tree: 5374e3e7a6dfb3a0ebbbb4c23a0e8291dae681ce [path history] [tgz]
  1. README.md
  2. docker-compose-alpha.yaml
  3. docker-compose-demo.yaml
  4. docker-compose.mysql.yaml
  5. docker-compose.yaml
  6. pom.xml
  7. saga-dubbo-demo.sh
  8. service-api/
  9. service-pub/
  10. servicea/
  11. serviceb/
  12. servicec/
  13. sql/
demo/saga-dubbo-demo/README.md

Saga-dubbo-demo

This demo including three services:

  • servicea
  • serviceb
  • servicec

Prerequisites

You will need:

  1. JDK 1.8
  2. Maven 3.x
  3. alpha server

Running Demo

  1. run the following command to create docker images in saga project root folder.

    mvn clean install -DskipTests -Pdocker -Pdemo
    
  2. 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:

    1. add dependency of mysql-connector-java in alpha/alpha-server/pom.xml
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
    
    1. re-generate saga's docker images in saga project root folder
    mvn package -DskipTests -Pdocker -Pdemo
    
    1. 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:

    1. start alpha server
        ./saga-dubbo-demo.sh up-alpha
    
    1. when alpha server started complatelly, then start the demo services
        ./saga-dubbo-demo.sh up-demo
    
  3. 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

Debugging

Take the spring-demo debugging as a reference.