The services in this project are designed with microservice architecture for performing distributed transaction using 2-Phase Commit (2PC).
Each microservice exposes REST API interfaces that can be accessed through OpenAPI endpoint (/swagger-ui.html)
- SpringBoot
- Spring Data JPA
- MySQL Database
- RabbitMQ
- RabbitMQ
- Start RabbitMQ in Docker with command
docker run -d --hostname my-rabbit --name some-rabbit -p 8080:15672 rabbitmq:3-management
Learn more
- Start RabbitMQ in Docker with command
- MySQL Database
- Start MySQL in Docker with command
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
Learn more
- Start MySQL in Docker with command
- Start
discovery-server
. Default port is 8761. - Start all microservices:
transaction-server
,account-service
,order-service
,product-service
- Add some test data to
account-service
andproduct-service
- Send order creation request to
order-service
for testing the flow.
In this microservice-based architecture design, discovery-server
plays an important role for registering and retrieving the service instances from a centralize location.
The transaction-server
is responsible for maintaining transaction status for multiple services for a given transactionId.
There are three applications: order-service
, account-service
and product-service
.
The application order-service
is communicating with account-service
and product-service
. All these applications are using MySQL database as a backend store.