6.1 MqttPublisher hosted service

Persistent MQTTnet v4 IMqttClient wrapped in a BackgroundService:
attempts to connect on StartAsync (logging and continuing on failure)
and reconnects on a 5s loop while running. Exposes IsConnected so
6.4 can wire it into /health later. Honors username/password and
UseTls from MqttOptions; clean session is disabled.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 15:10:59 +02:00
parent 521c95c10b
commit a6c750d5c4
3 changed files with 136 additions and 1 deletions

View File

@@ -151,7 +151,7 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor.
## Phase 6 — MQTT
### [ ] 6.1 `MqttPublisher` hosted service
### [x] 6.1 `MqttPublisher` hosted service
- Singleton `IHostedService` wrapping `IMqttClient` (MQTTnet v4).
- `WithReconnectDelay`, `WithCleanSession(false)`, credentials/TLS from `MqttOptions`.
- Exposes `bool IsConnected` for `/health`.