Skip to content

Latest commit

 

History

History
97 lines (84 loc) · 2.44 KB

File metadata and controls

97 lines (84 loc) · 2.44 KB

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.