Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Latest commit

 

History

History
72 lines (65 loc) · 2.02 KB

File metadata and controls

72 lines (65 loc) · 2.02 KB

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.