A comprehensive microservices architecture built with Spring Boot, featuring service discovery, message queuing, distributed tracing, and containerization.
- π€ Customer Service - Port 8080
- π‘οΈ Fraud Detection Service - Port 8081
- π§ Notification Service - Port 8082
- π― Eureka Server - Service Discovery (Port 8761)
- πͺ API Gateway - Spring Cloud Gateway (Port 8080)
- βοΈ Config Server - Centralized Configuration (Port 8888)
| Component | Technology |
|---|---|
| Framework | Spring Boot 2.5.7 |
| Language | Java 17 |
| Database | PostgreSQL |
| Message Broker | RabbitMQ |
| Service Discovery | Netflix Eureka |
| API Gateway | Spring Cloud Gateway |
| Containerization | Docker |
| Distributed Tracing | Zipkin + Sleuth |
| Build Tool | Maven |
Database Credentials:
Username: devarifkhan
Password: password
Database: mds
Port: 5433 (local) / 5432 (docker)- Java 17+
- Maven 3.6+
- Docker & Docker Compose
- PostgreSQL
git clone <repository-url>
cd microservices_and_distributed_systemsmvn clean installdocker-compose up -d postgres rabbitmq zipkin# Start Eureka Server
cd eureka-server && mvn spring-boot:run
# Start Config Server
cd config-server && mvn spring-boot:run
# Start API Gateway
cd apigw && mvn spring-boot:run
# Start Core Services
cd customer && mvn spring-boot:run
cd fraud && mvn spring-boot:run
cd notification && mvn spring-boot:runmvn clean package -Pbuild-docker-imagedocker-compose up| Service | Local URL | Docker URL |
|---|---|---|
| Eureka Dashboard | http://localhost:8761 | http://eureka-server:8761 |
| API Gateway | http://localhost:8080 | http://apigw:8080 |
| Customer API | http://localhost:8080/customer | http://customer:8080 |
| Fraud API | http://localhost:8080/fraud | http://fraud:8081 |
| Zipkin UI | http://localhost:9411 | http://zipkin:9411 |
Each service supports multiple profiles:
default- Local developmentdocker- Docker container deploymentkube- Kubernetes deployment
Exchanges:
- internal.exchange (Topic)
Queues:
- notification.queue
Routing Keys:
- internal.notification.routing-key- Customer Service β Publishes events β Exchange
- Fraud Service β Publishes events β Exchange
- Exchange β Routes messages β Notification Queue
- Notification Service β Consumes messages β Sends notifications
All services integrate with Zipkin via Spring Cloud Sleuth:
- Automatic trace generation
- Cross-service correlation
- Performance monitoring
- Request flow visualization
- API Key Authentication via API Gateway
- Rate Limiting and throttling
- SSL/TLS encryption
- JWT Token validation
- OAuth 2.0 authorization
- Health Checks - Spring Boot Actuator
- Metrics Collection - Micrometer
- Distributed Tracing - Zipkin + Sleuth
- Centralized Logging - ELK Stack ready
microservices_and_distributed_systems/
βββ customer/ # Customer microservice
βββ fraud/ # Fraud detection service
βββ notification/ # Notification service
βββ eureka-server/ # Service discovery
βββ apigw/ # API Gateway
βββ clients/ # Shared client libraries
βββ amqp/ # Message queue utilities
βββ k8s/ # Kubernetes manifests
βββ docker-compose.yml # Docker orchestration
βββ pom.xml # Parent POM
- Customer β Fraud (HTTP REST)
- API Gateway β All Services (HTTP REST)
- Customer β RabbitMQ β Notification
- Fraud β RabbitMQ β Notification
curl -X POST http://localhost:8080/api/v1/customers \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]"
}'curl -X GET http://localhost:8080/api/v1/fraud-check/1-
Port Conflicts
# Check port usage netstat -tulpn | grep :8080
-
Database Connection
# Test PostgreSQL connection psql -h localhost -p 5433 -U devarifkhan -d mds -
Service Discovery
- Check Eureka Dashboard: http://localhost:8761
- Verify service registration
-Xms512m -Xmx1024m
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200spring:
datasource:
hikari:
maximum-pool-size: 20
minimum-idle: 5- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
β Star this repository if you find it helpful!
