tree: 2c4ef87c21fa9496e9a6abb5c357690b7df7370e [path history] [tgz]
  1. scb-booking/
  2. scb-car/
  3. scb-hotel/
  4. docker-compose.yaml
  5. pom.xml
  6. README.md
  7. saga-servicecomb-demo.sh
demo/saga-servicecomb-demo/README.md

Booking Demo

This demo simulates a booking application including three services:

  • booking
  • car
  • hotel

Prerequisites

You will need:

  1. JDK 1.8
  2. Maven 3.x
  3. Docker
  4. Docker compose
  5. alpha server

Running Demo

You can run the demo using either docker compose or executable files.

via docker compose

  1. run the following command to create docker images in saga project root folder.
    mvn clean package -DskipTests -Pdocker -Pdemo
    
  2. Enter the saga servicecomb demo directory and give permissions to script
    cd ./saga-demo/saga-servicecomb-demo
    chmod +x saga-servicecomb-demo.sh
    
  3. start the whole application up(including alpha server and three demo services)
    ./saga-servicecomb-demo.sh up
    
  4. stop application
    ./saga-servicecomb-demo.sh down
    

User Requests by command line tools

  1. Booking 2 rooms and 2 cars, this booking will be OK.
curl -X POST http://${host_address}:8083/booking/test/2/2

Check the hotel booking status with

curl http://${host_address}:8081/bookings

Check the car booking status with

curl http://${host_address}:8082/bookings

  1. Booking 3 rooms and 2 cars, this booking will cause the hotel order failed and trigger the compensate operation with car booking.
curl -X POST http://${host_address}:8083/booking/test/3/2

Check the hotel booking status with

curl http://${host_address}:8081/bookings

Check the car booking status with

curl http://${host_address}:8082/bookings

The second car booking will be marked with cancel:true

Debugging

Take the spring-demo debugging as a reference.