A distributed microservices-based platform for weather consultation, featuring city management, weather data retrieval, weather-based alerts, and request history tracking. The application demonstrates a scalable microservices architecture with service discovery, fault tolerance, and resilient inter-service communication.
The system is composed of 4 independent microservices:
| Service | Port | Description |
|---|---|---|
| Eureka Server | 8761 | Service discovery and registry |
| City Service | 8081 | City management (CRUD operations) |
| Weather Service | 8082 | Weather data retrieval and orchestration |
| Alert Service | 8083 | Weather-based alerts and notifications |
| History Service | 8084 | Weather request history persistence |
Client β Weather Service β City Service (verify city)
β
OpenWeather API
β
History Service (store request)
β
Alert Service (check conditions)
β
Response to Client
- Java 17
- Spring Boot 3
- Spring Cloud Netflix Eureka
- Spring Data JPA
- H2 In-Memory Database
- Maven
- OpenFeign (Declarative REST client)
- RestTemplate (HTTP communication)
- OpenWeather API (External weather data provider)
- Resilience4j (Circuit Breaker pattern)
- Automatic fallback handling
- Service failure isolation
- Java 17+
- Maven
- Internet connection (for OpenWeather API)
- OpenWeather API key (Get one here)
Important: Services must be started in the following sequence to ensure proper registration and communication:
- Eureka Server (Service Registry)
- City Service (Reference Data)
- History Service (Data Persistence)
- Weather Service (Business Orchestrator)
- Alert Service (Notification System)
Update application.properties in Weather Service:
weather.api.key=YOUR_OPENWEATHER_API_KEYTo obtain an API key:
- Visit OpenWeatherMap
- Create a free account
- Generate an API key from your dashboard
For each service, navigate to its directory and run:
mvn clean install
mvn spring-boot:run| Service | URL | Credentials |
|---|---|---|
| Eureka Dashboard | http://localhost:8761 | - |
| City H2 Console | http://localhost:8081/h2-console | JDBC URL: jdbc:h2:mem:citydb |
| History H2 Console | http://localhost:8084/h2-console | JDBC URL: jdbc:h2:mem:historydb |
Get All Cities
GET /citiesGet City by Name
GET /cities/{name}Add New City
POST /cities
Content-Type: application/json
{
"name": "Paris",
"country": "FR"
}Get Weather for City
GET /weather/{city}Response example:
{
"city": "Paris",
"temperature": 15.5,
"humidity": 65,
"description": "Partly cloudy",
"timestamp": "2024-01-15T10:30:00"
}Get Request History
GET /historyGet Weather Alerts for City
GET /alerts/{city}The Weather Service acts as the main orchestrator:
- City Verification: Checks if the requested city exists via City Service
- Data Retrieval: Calls the OpenWeather API to fetch weather data
- History Logging: Stores the request in History Service
- Alert Check: Triggers Alert Service to check notification conditions
- Response: Returns processed weather data to the client
- Fault Handling: In case of failure β Circuit Breaker activates / Fallback response
The platform implements Resilience4j patterns for system stability:
- Monitors service health and prevents cascading failures
- Opens circuit when failure threshold is reached
- Automatically attempts recovery after cooldown period
- Provides cached or default responses when services are unavailable
- Ensures graceful degradation of functionality
- Maintains user experience during partial outages
- Service failures are contained and don't affect other microservices
- Independent failure domains for each service
weather-microservices-platform/
β
βββ eureka-server/ # Service discovery
βββ city-service/ # City management
βββ weather-service/ # Weather orchestrator
βββ alert-service/ # Alert notifications
βββ history-service/ # Request history
Each microservice follows the standard Spring Boot structure:
service-name/
βββ src/main/java
β βββ controller/
β βββ service/
β βββ repository/
β βββ entity/
β βββ config/
βββ src/main/resources
βββ application.properties
β
All microservices implemented and functional
β
Service discovery with Eureka
β
Circuit breaker and fault tolerance
β
External API integration
β³ Frontend dashboard (planned)
β³ Database migration to PostgreSQL (planned)
- API Gateway implementation (Spring Cloud Gateway)
- Authentication and authorization (OAuth2/JWT)
- Persistent database migration (PostgreSQL/MySQL)
- Monitoring and logging (Prometheus, Grafana, ELK Stack)
- Docker containerization and Kubernetes orchestration
- Frontend dashboard with real-time weather updates
- Notification system (Email/SMS alerts)
- Unit and integration testing
- API documentation with Swagger/OpenAPI
Sara Tahiri
π GitHub: github.com/SaraTahiri
πΌ LinkedIn: linkedin.com/in/tahiri-sara
Anas Lahmidi
π GitHub: github.com/AnasLahmidi
πΌ LinkedIn: linkedin.com/in/anas-lahmidi
For questions, suggestions, or collaboration opportunities:
π§ tahirisara911@gmail.com
π§ anaslahmidi03@gmail.com
This project is developed for educational purposes.