PolyStore is a small project that allows you to take orders from a store and checkout them. This project is made with six microservices :
Discovery server
: Eureka server. It allows to register all microservices and to discover them.Gateway
: Simple gateway that allows to redirect requests to the right microservice. It also allows to aggregate data from several microservices.Catalog
: Manage products and their name.Inventory
: Manage the products quantities and their price.Cart
: Manage the cart of a customer.Order
: Manage the orders of a customer.
- Java 11
- Maven
First, you need to clone the project :
git clone [email protected]:Alexis-Bernard/PolyStore.git
Move to the project directory :
cd {project_name}
Then, you need to build the project :
mvn package
Finally, you can run the project :
java -jar ./target/{project_name}-0.0.1-SNAPSHOT.jar
⚠️ You need to run the discovery server first !: All microservices need to register to the discovery server. If you don't run the discovery server, the microservices will not be able to register and cannot work.
The project use the SAGA pattern with the choreography approach only for the checkout process. The other processes are simple CRUD operations.
Here is the sequence diagram of the checkout process :
As you can see, each microservice is responsible for a specific task, and if en error occurs, it will send an event to the a queue for his previous microservice. For example, if the inventory service fails to update the quantity of a product, it will send an event to the cart service to cancel the cart edition.