MQTT Protocol

1. Project Overview

Purpose and Scope:
This system is an MQTT subscriber designed for Freeport FMI. It connects to a local Mosquitto MQTT broker, listens for sensor data on a specific topic pattern, and performs two main actions:

Primary Use Cases:

Explicitly Not Handled:


2. System Architecture

Core Components:

Data and Control Flow:

  1. MQTT client connects to broker and subscribes to a topic.
  2. On message receipt:

External Services and Dependencies:


3. Core Concepts & Domain Logic

Key Abstractions and Domain Terms:

Business/Technical Invariants:

Mental Model:


4. Codebase Structure

Single-file Script:

Responsibility Boundaries:

What Changes Together:


5. Configuration & Environment

Environment Variables:

Configuration Files:

Environment Differences:


6. Runtime Behavior

Startup Sequence:

Normal Execution Flow:

Error Handling and Logging:


7. Deployment & Operations

Build Process:

Deployment Method:

Runtime Dependencies:

Scaling and Rollback:


8. Extending the System

Where and How to Add New Features:

Recommended Patterns:

Anti-patterns and Risk Areas:

Testing Strategy:


9. Security & Compliance

Authentication and Authorization:

Secrets Handling:

Data Sensitivity:


10. Common Pitfalls & Gotchas

11. Other components of the protocol.