Message Flow
Complete Message Flow
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MQTT Broker │───▶│ Route Matcher │───▶│ Middleware │───▶│ Controller │
│ │ │ │ │ Pipeline │ │ Handler │
│ - Receives Msg │ │ - Topic Match │ │ - Auth Check │ │ - Business │
│ - Delivers │ │ - Extract Params│ │ - Rate Limit │ │ Logic │
│ - Load Balance │ │ - Find Route │ │ - Logging │ │ - Data Process │
└─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │ │
│ │ │ ▼
│ │ │ ┌─────────────────┐
│ │ │ │ Response │
│ │ │ │ │
│ │ │ │ - Publish Reply │
│ │ │ │ - Update State │
│ │ │ │ - Log Result │
│ │ │ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Error Case │ │ No Route │ │ Middleware │
│ │ │ │ │ Blocked │
│ - Log Error │ │ - Log Warning │ │ │
│ - Continue │ │ - Continue │ │ - Auth Failed │
│ Operation │ │ Operation │ │ - Rate Limited │
└─────────────────┘ └─────────────────┘ └─────────────────┘Step-by-Step Flow
1. Message Reception
2. Route Matching
Route Matching Example
3. Parameter Extraction
4. Middleware Pipeline Processing
Middleware Chain Example
5. Controller Handler Execution
Context Object
Error Handling Flow
Route Not Found
Middleware Errors
Handler Errors
Async Processing
Non-Blocking Operations
Concurrent Message Handling
Shared Subscription Flow
Worker Message Flow
Performance Characteristics
Throughput Optimization
Latency Optimization
Message Flow Examples
Simple Temperature Reading
API Gateway Flow
Flow Monitoring
Built-in Logging
Custom Monitoring
Next Steps
Last updated