Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌀️ WeatherEventMashup

Spring Boot Java OpenAPI Redis Docker

Description

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

Objectifs PΓ©dagogiques

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

Performance

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 !

Stack Technique

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

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client HTTP   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Controller    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AgendaService  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    β”‚                    β”‚
β–Ό                    β–Ό                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚WeatherService β”‚   β”‚ EventService  β”‚   β”‚   RecoService β”‚
β”‚   (MΓ©tΓ©o)     β”‚   β”‚ (Γ‰vΓ©nements)  β”‚   β”‚ (Recommand.)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚                   β”‚                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚  Redis Cache  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quick Start

PrΓ©requis

# Java 17+
java -version

# Docker & Docker Compose
docker --version
docker-compose --version

# Maven
mvn --version

Installation

1. Cloner le projet

git clone https://github.com/ASSONDJI/WeatherEventMashup.git cd WeatherEventMashup

2. DΓ©marrer Redis avec Docker

docker-compose up -d

3. Compiler le projet

mvn clean compile

4. Lancer l'application

mvn spring-boot:run

Configuration des clΓ©s API (Optionnel)

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

Documentation API

Une fois l'application dΓ©marrΓ©e :

Swagger UI : http://localhost:8080/swagger-ui.html

OpenAPI JSON : http://localhost:8080/api-docs

Endpoints disponibles

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

Tests

Health check

curl http://localhost:8080/api/v1/health

Agenda (mode parallèle)

curl "http://localhost:8080/api/v1/agenda?city=Paris&date=2024-12-25"

Benchmark

curl "http://localhost:8080/api/v1/agenda/benchmark?city=Paris&date=2024-12-25"

Exemple de RΓ©ponse

{
"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"
}

STRUCTURE SIMPLE ET PROFESSIONNELLE DU PROJET

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

FLUX D'EXÉCUTION

  1. Client β†’ GET /api/v1/agenda?city=Paris
  2. Controller β†’ reΓ§oit la requΓͺte
  3. AgendaService β†’ lance 3 appels en PARALLÈLE
  4. WeatherService β†’ interroge API mΓ©tΓ©o (ou mock)
  5. EventService β†’ interroge API Γ©vΓ©nements (ou mock)
  6. RecoService → génère recommandations
  7. AgrΓ©gation β†’ combine les 3 rΓ©sultats
  8. RΓ©ponse β†’ JSON renvoyΓ© au client

TEMPS D'EXÉCUTION

  • Mode SΓ‰QUENTIEL : Weather + Events + Recos = 550ms
  • Mode PARALLÈLE : MAX(Weather, Events, Recos) = 200ms
  • GAIN : 2.75x plus rapide

Auteur

Γ‰tudiant : MALAIKA LADEESSE ASSONDJI

EncadrΓ© par : Pr. BOMGNI Alain Bertrand

  • Cours : Introduction Γ  l'Intergiciel (Middleware)
  • AnnΓ©e acadΓ©mique : 2025/2026

Licence MIT

Remerciements

  • OpenWeatherMap pour l'API mΓ©tΓ©o
  • Ticketmaster pour l'API Γ©vΓ©nements
  • La communautΓ© OpenAPI Generator

About

Spring Boot mashup combining Weather API + Events API + Recommendations - Parallel calls with CompletableFuture, Caching, and Circuit Breaker

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages