# Architecture Finale Smart City - 2 Pipelines Isolées (CORRIGÉ 18h05) ## Principe : Chaque Context Broker a sa propre pipeline ``` ┌─────────────────────────────────────────────────────────────────────────────┐ │ Smart City Simulator (Python) │ │ Publie sur 3 brokers MQTT avec format IoT-Agent JSON │ └──────────┬────────────────────┬──────────────────────┬───────────────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ EMQX Broker │ │ Mosquitto Broker │ │ BunkerM Broker │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ IoT-Agent-EMQX │ │IoT-Agent-Mosquitto│ │IoT-Agent-BunkerM │ │ Port: 4041 │ │ Port: 4042 │ │ Port: 4043 │ │ Apikey: smart- │ │ Apikey: smart- │ │ Apikey: smart- │ │ city-api-key │ │ city-api-key │ │ city-api-key │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ └───────────────────────┴──────────────────────┘ │ ▼ ┌───────────────┴───────────────┐ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ Orion-LD │ │ Stellio │ │ (port 1026) │ │ (port 8080) │ │ MongoDB backend │ │ (API Gateway) │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ QuantumLeap-Orion │ │ QuantumLeap-Stellio │ │ (port 8668) │ │ (port 8669) │ │ → CrateDB-Orion │ │ → CrateDB-Stellio │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ CrateDB-Orion │ │ CrateDB-Stellio │ │ (port 5432/4200) │ │ (port 5433/4201) │ │ DB: quantumleap │ │ DB: quantumleap_ │ │ │ │ stellio │ └─────────┬───────────┘ └─────────┬───────────┘ │ │ └───────────────────────┬─────────┘ │ ▼ ┌─────────────────────┐ │ Grafana │ │ (port 3001) │ │ 2 Datasources: │ │ - CrateDB-Orion │ │ - CrateDB-Stellio│ └─────────────────────┘ ``` ## Pipelines Complètes ### Pipeline 1 : Orion-LD ✅ (Opérationnel) 1. Simulateur → 3 MQTT Brokers 2. 3 IoT-Agents → Orion-LD (1026) 3. **Orion-LD Subscription** → QuantumLeap-Orion (8668) ✅ 4. QuantumLeap-Orion → CrateDB-Orion (5432) ✅ 5. Grafana ← CrateDB-Orion ✅ ### Pipeline 2 : Stellio 🔄 (En cours) 1. Simulateur → 3 MQTT Brokers 2. 3 IoT-Agents → Stellio (8080) *(à configurer)* 3. **Stellio Subscription** → QuantumLeap-Stellio (8669) *(en cours)* 4. QuantumLeap-Stellio → CrateDB-Stellio (5433) ✅ 5. Grafana ← CrateDB-Stellio ✅ ## Configuration des Subscriptions ### Pour Orion-LD (déjà fait) ✅ ```bash curl -X POST http://localhost:1026/v2/subscriptions \ -H 'Content-Type: application/json' \ -d '{ "description": "Orion-LD to QuantumLeap-Orion", "subject": {"entities": [{"idPattern": ".*", "type": "AirQualityObserved"}]}, "notification": { "http": {"url": "http://smart-city-quantumleap:8668/v2/op/notify"} } }' ``` ### Pour Stellio (à faire) 🔄 ```bash # Stellio utilise l'API NGSI-LD pour les subscriptions curl -X POST http://localhost:8080/ngsi-ld/v1/subscriptions \ -H 'Content-Type: application/ld+json' \ -d '{ "description": "Stellio to QuantumLeap-Stellio", "type": "Subscription", "entities": [{"type": "AirQualityObserved"}], "notification": { "endpoint": {"uri": "http://smart-city-quantumleap-stellio:8668/v2/op/notify"} } }' ``` ## États des Services | Service | Container | Port | Statut | |---------|-----------|------|--------| | **Orion-LD** | smart-city-orion-ld | 1026 | ✅ Up | | **QuantumLeap-Orion** | smart-city-quantumleap | 8668 | ✅ Up | | **CrateDB-Orion** | smart-city-cratedb | 5432/4200 | ✅ Up | | **Stellio** | stellio-api-gateway | 8080 | ✅ Up | | **QuantumLeap-Stellio** | smart-city-quantumleap-stellio | 8669 | ✅ Up | | **CrateDB-Stellio** | smart-city-cratedb-stellio | 5433/4201 | ✅ Up | | **3 IoT-Agents** | smart-city-iot-agent-* | 4041-4043 | ✅ Up | | **Grafana** | smart-city-grafana | 3001 | ✅ Up | ## Prochaines Étapes 1. ✅ **Orion-LD → QuantumLeap-Orion** (Déjà configuré et opérationnel) 2. 🔄 **Stellio → QuantumLeap-Stellio** (En cours de configuration) 3. ⏳ **Configurer IoT-Agents** pour envoyer aussi à Stellio 4. ⏳ **Tester le flux complet** avec Stellio 5. ⏳ **Créer les dashboards Grafana** (2 sources) ## Notes Importantes - **Orion-LD** : Utilise l'API NGSI-v2 (`/v2/...`) - **Stellio** : Utilise l'API NGSI-LD (`/ngsi-ld/v1/...`) - **QuantumLeap** : Reçoit les notifications et stocke dans CrateDB - **Grafana** : Visualise les données des 2 CrateDB --- *Dernière mise à jour : 06 Mai 2026, 18h05 - Correction architecture (Orion→QL-Orion, Stellio→QL-Stellio)*