Specify MQTT reconnect behavior

Add SPEC.md §5.2 describing reconnect requirements (backoff, keep-alive
detection, disconnect logging, unique ClientId), the new Mqtt config
keys, the matching PLAN.md design and verification steps, and
IMPLEMENTATION.md increment 6.6. Also drop the stale WithReconnectDelay
reference, which only exists on ManagedMqttClient.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
zyberzeroandClaude Opus 5.5 committed 2026-11-03 18:51:43 +01:00
1 parent 96934b6824
commit 8dd42d24bc
3 files changed
+32 -6

No files matched your search

+7 -1
View File
@@ -153,7 +153,7 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor.
### [x] 6.1 `MqttPublisher` hosted service
- Singleton `IHostedService` wrapping `IMqttClient` (MQTTnet v4).
- `WithReconnectDelay`, `WithCleanSession(false)`, credentials/TLS from `MqttOptions`.
- `WithCleanSession(false)`, credentials/TLS from `MqttOptions`. (Reconnect is hand-rolled — see 6.6.)
- Exposes `bool IsConnected` for `/health`.
- On `StartAsync`: connect; on failure, log and continue (background reconnect handles it).
@@ -173,6 +173,12 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor.
- On reconnect, drain immediately.
- **Manual check:** stop broker, upload → 200 with `mqttPublished: false`; restart broker → `mosquitto_sub` sees the message within backoff window.
### [ ] 6.6 Reliable auto-reconnect (`SPEC.md` §5.2)
- `MqttOptions`: `ReconnectBackoffSeconds`, `KeepAliveSeconds`, `ConnectTimeoutSeconds`; wire keep-alive + connect timeout into `BuildClientOptions()`.
- `DisconnectedAsync` handler logs the reason and signals a `_reconnect` channel; only `ExecuteAsync` calls `ConnectAsync`.
- Reconnect loop uses the backoff schedule (capped, reset on success) instead of the hardcoded 5 s poll; wakes the retry queue on success.
- **Manual check:** `PLAN.md` verification items 7, 7a, 7b.
---
## Phase 7 — URL-fetch ingestion