- Java 17
- Spring Boot 3
- RabbitMQ
- Redis
- Eureka (Server & Client)
- WebSockets
- PostgreSQL
- Lombok
- Hibernate
- Docker (Docker Compose)
- Docker Registry
- Kubernetes (k8s)
This project is a microservices-based architecture designed to facilitate efficient communication and message routing. The system is composed of four main services: app
, chats
, eureka
, and gateway
. Each service has a distinct role, contributing to the overall functionality and robustness of the application.
- Description: The
app
service is the central component of the system. It handles the core business logic and is responsible for sending messages. - Functionality: When a message needs to be sent, the
app
service publishes it to RabbitMQ, a messaging broker, which ensures reliable message delivery to the intended recipient service.
- Description: The
chats
service is dedicated to managing and processing chat messages. - Functionality: It consumes messages from RabbitMQ that are sent by the
app
service. Thechats
service handles these messages appropriately, such as storing them, updating chat history, or triggering further actions within the chat context. By the way, this service caching messages in Redis.
- Description: The
eureka
service acts as a service registry, allowing other microservices to discover each other. - Functionality: By registering each service instance with Eureka, the system maintains an updated directory of all running services and their instances. This dynamic discovery is crucial for ensuring that messages are routed correctly and services can communicate seamlessly.
- Description: The
gateway
service serves as an entry point for all client requests and manages routing and load balancing. - Functionality: It routes incoming requests to the appropriate microservice instance based on the request's nature and current system load. The gateway's load balancing capabilities help distribute traffic evenly across service instances, ensuring optimal performance and reliability.
- The
app
service sends messages by publishing them to RabbitMQ. - RabbitMQ acts as an intermediary, ensuring messages are delivered to the
chats
service.
- All services register with the
eureka
service, enabling them to discover each other dynamically. - The
gateway
service, upon receiving client requests, consults theeureka
registry to determine the optimal service instance for routing the request.
- The
gateway
service implements load balancing, distributing incoming traffic among available instances to enhance system stability and performance.
- Scalability: The microservices architecture allows individual services to be scaled independently, enhancing the system's ability to handle varying loads.
- Flexibility: Each microservice can be developed, deployed, and maintained independently, allowing for greater agility in updates and improvements.
- Resilience: The use of RabbitMQ for messaging ensures reliable communication between services, even in cases of service failure or downtime.
- Efficient Routing: The gateway service's routing and load balancing capabilities ensure efficient use of resources and optimal response times.
This project leverages a microservices architecture to create a robust, scalable, and efficient system for managing and routing messages. By integrating services like RabbitMQ, Eureka, and a sophisticated gateway, the system ensures reliable communication, dynamic service discovery, and effective load balancing, all contributing to a high-performance application environment.