An e-commerce system written in a microservice architecture. Communication between applications is implemented mainly with events that are processed by Kafka
The following applications are domain services:
- cart-service
- logging-service
- notification-service
- order-service
- user-management-service
- warehouse-service
The following applications are infrastructure/application services:
- api-service-gateway
- config-server
- eureka-server
- schema-registry-server
- Kafka
- traffic-simulator
All the services are implemented with Java 11 and Spring Framework. Each application is built with Gradle. They use Config Server and Eureka Server.
The api-gateway-service is an application that runs as a Zuul Gateway. It delegates all the calls into proper services.
All the domain applications publish to Kafka two kinds of messages:
- domain events - messages that notify about a fact that has happened in the system, e.g. user account created.
- commands/queries - messages related to CQRS implementation. Those messages are used to pass information within an application/service.
There are two main types of Kafka Topics:
- service-name-events - topics for domain events. Domain services are allowed to listening to only those streams.
- application-command-topic - a topic for command/queries messages
All the messages are transferred as Avro Messages. The schema of all events is available in the avro/ directory. Microservices are using schema-registry-server to register and receive schema related information.
- Cover services with unit tests.
- Write integration tests. Consider Spring Cloud Contract.
- Refactor traffic-simulator.
- Do not use repositories in controllers. Push Queries and handle them in proper handlers.
- Implement Event Sourcing for restoring applications' state.