$ show mqtt-tools/mqttwarn
mqttwarn is an MQTT message routing application that subscribes to topics and forwards payloads to notification services after applying user-defined transformations. It features a plugin-based architecture with over 70 built-in services (e.g., Slack, Twilio, HTTP, databases) and supports dynamic routing via INI configuration. The system runs as a long-lived daemon with worker threads for asynchronous processing, periodic task scheduling, and automatic reconnection. Core components include MQTT client handling, job queuing, transformation pipelines (filter, datamap, format), and a context manager for accessing configuration and custom functions. While the core is well-structured, the extensive service list creates maintenance overhead and potential dependency drift.
The LLM identified 2 files worth highlighting for reuse:
Implements PeriodicThread class for running functions at fixed intervals with optional immediate execution. This reusable threading utility decouples scheduling logic from application core and is used for MQTT liveness checks and user-defined cron jobs. Demonstrates clean encapsulation of timing concerns with minimal dependencies (only threading, time, logging).
Provides load_functions for safely loading user-defined functions from a module (used for transformation plugins) and Timeout context manager for limiting operation duration. These utilities demonstrate encapsulation of cross-cutting concerns with minimal coupling. The function loading pattern supports extensibility while isolating plugin risks, and the timeout utility prevents blocking operations in service handlers.