WeatherEventMashup est une application de mashup qui combine trois sources de donnΓ©es :
- MΓ©tΓ©o (OpenWeatherMap API)
- ΓvΓ©nements culturels (Ticketmaster API)
- Recommandations personnalisΓ©es (service interne)
L'application démontre les concepts avancés de middleware pour les systèmes distribués :
- Appels parallèles avec
CompletableFuture.allOf() - Cache distribuΓ© avec Redis
- Circuit Breaker avec Resilience4j
- GΓ©nΓ©ration automatique de code via OpenAPI
Ce projet illustre les concepts clΓ©s du cours Introduction Γ l'Intergiciel :
| Concept | ImplΓ©mentation |
|---|---|
| Composition de services SOA (Mashup) | Combinaison de 3 APIs distinctes |
| Appels parallèles | CompletableFuture.allOf() - temps total = max(latences) |
| WebClient (rΓ©actif) | Appels HTTP non-bloquants |
| Cache (Fielding) | Redis avec TTL 10 minutes |
| Circuit Breaker | Resilience4j pour la rΓ©silience |
L'approche parallèle offre un gain significatif : Mode Séquentiel : ~900ms (Somme des 3 appels) Mode Parallèle : ~300ms (Maximum des 3 appels) Gain : 3x plus rapide !
| Composant | Technologie | Version |
|---|---|---|
| Framework | Spring Boot | 3.2.4 |
| Langage | Java | 17 |
| Cache | Redis | 7.0 |
| Containerisation | Docker | 24.0 |
| Documentation API | OpenAPI | 3.1 |
| GΓ©nΓ©ration code | OpenAPI Generator | 7.5.0 |
| Circuit Breaker | Resilience4j | 2.2.0 |
| Mapping | MapStruct | 1.5.5 |
| RΓ©duction boilerplate | Lombok | latest |
βββββββββββββββββββ
β Client HTTP β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Controller β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β AgendaService β
ββββββββββ¬βββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
βWeatherService β β EventService β β RecoService β
β (MΓ©tΓ©o) β β (ΓvΓ©nements) β β (Recommand.) β
βββββββββ¬ββββββββ βββββββββ¬ββββββββ βββββββββ¬ββββββββ
β β β
βββββββββββββββββββββΌββββββββββββββββββββ
β
βββββββββΌββββββββ
β Redis Cache β
βββββββββββββββββ# Java 17+
java -version
# Docker & Docker Compose
docker --version
docker-compose --version
# Maven
mvn --versiongit clone https://github.com/ASSONDJI/WeatherEventMashup.git cd WeatherEventMashup
docker-compose up -d
mvn clean compile
mvn spring-boot:run
Pour utiliser les vraies APIs, dΓ©finissez les variables d'environnement : export OPENWEATHER_API_KEY=votre_clΓ©_ici export TICKETMASTER_API_KEY=votre_clΓ©_ici
Une fois l'application dΓ©marrΓ©e :
Swagger UI : http://localhost:8080/swagger-ui.html
OpenAPI JSON : http://localhost:8080/api-docs
MΓ©thode Endpoint Description
- GET /api/v1/health VΓ©rification de santΓ© du service
- GET /api/v1/agenda?city=Paris&date=2024-12-25 Agenda complet (appels parallèles)
- GET /api/v1/agenda/benchmark?city=Paris&date=2024-12-25 Benchmark séquentiel vs parallèle
- GET /api/v1/health/circuit-breakers Statut des circuit breakers
curl http://localhost:8080/api/v1/health
curl "http://localhost:8080/api/v1/agenda?city=Paris&date=2024-12-25"
curl "http://localhost:8080/api/v1/agenda/benchmark?city=Paris&date=2024-12-25"
{
"city": "Paris",
"date": "2024-12-25",
"weather": {
"city": "Paris",
"condition": "Sunny",
"temperature": 22.5,
"feelsLike": 23.0,
"humidity": 65,
"description": "Pleasant weather"
},
"events": [
{
"id": "1",
"name": "Jazz Festival",
"venue": "Downtown Theater",
"category": "Music"
}
],
"recommendations": [
{
"activity": "Visit Historic Center",
"venue": "Paris Old Town",
"priority": 1
}
],
"processingTimeMs": 312,
"mode": "PARALLEL"
}WeatherEventMashup/
β
βββ src/
β βββ main/
β βββ java/com/mashup/
β β βββ WeatherEventMashupApplication.java
β β β
β β βββ config/
β β β βββ WebClientConfig.java
β β β βββ RedisConfig.java
β β β
β β βββ controller/
β β β βββ AgendaController.java
β β β βββ HealthController.java
β β β
β β βββ service/
β β β βββ AgendaService.java
β β β βββ WeatherService.java
β β β βββ EventService.java
β β β βββ RecommendationService.java
β β β
β β βββ dto/
β β β βββ generated/ # GΓ©nΓ©rΓ© par OpenAPI
β β β βββ WeatherResponse.java
β β β βββ EventResponse.java
β β β βββ RecommendationResponse.java
β β β βββ AgendaResponse.java
β β β
β β βββ api/ # GΓ©nΓ©rΓ© par OpenAPI
β β β βββ AgendaApi.java
β β β βββ HealthApi.java
β β β
β β βββ exception/
β β βββ CityNotFoundException.java
β β βββ GlobalExceptionHandler.java
β β
β βββ resources/
β βββ application.yml
β βββ openapi.yaml
β
βββ docker-compose.yml
βββ pom.xml
βββ README.md- Client β GET /api/v1/agenda?city=Paris
- Controller β reΓ§oit la requΓͺte
- AgendaService β lance 3 appels en PARALLΓLE
- WeatherService β interroge API mΓ©tΓ©o (ou mock)
- EventService β interroge API Γ©vΓ©nements (ou mock)
- RecoService β gΓ©nΓ¨re recommandations
- AgrΓ©gation β combine les 3 rΓ©sultats
- RΓ©ponse β JSON renvoyΓ© au client
- Mode SΓQUENTIEL : Weather + Events + Recos = 550ms
- Mode PARALLΓLE : MAX(Weather, Events, Recos) = 200ms
- GAIN : 2.75x plus rapide
Γtudiant : MALAIKA LADEESSE ASSONDJI
EncadrΓ© par : Pr. BOMGNI Alain Bertrand
- Cours : Introduction Γ l'Intergiciel (Middleware)
- AnnΓ©e acadΓ©mique : 2025/2026
Licence MIT
- OpenWeatherMap pour l'API mΓ©tΓ©o
- Ticketmaster pour l'API Γ©vΓ©nements
- La communautΓ© OpenAPI Generator