From 0f681753c1d40eb229b0fe4e1f747df76f041a06 Mon Sep 17 00:00:00 2001 From: Fritiof Hedman Date: Sun, 7 Jun 2026 15:20:21 +0200 Subject: [PATCH] 6.4 /health reports MQTT status Inject MqttPublisher into HealthController and surface IsConnected as mqttConnected, replacing the hardcoded false. Co-Authored-By: Claude Opus 4.7 (1M context) --- IMPLEMENTATION.md | 2 +- src/FrameProcessor/Controllers/HealthController.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 3059fb9..f588a6c 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -164,7 +164,7 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor. ### [x] 6.3 Wire into `FramesController` - After successful save, call `PublishAsync`; set `mqttPublished` accordingly in the response. -### [ ] 6.4 `/health` reports MQTT status +### [x] 6.4 `/health` reports MQTT status - Replace hardcoded `mqttConnected` with `MqttPublisher.IsConnected`. ### [ ] 6.5 Background retry queue diff --git a/src/FrameProcessor/Controllers/HealthController.cs b/src/FrameProcessor/Controllers/HealthController.cs index 6a66177..f529b62 100644 --- a/src/FrameProcessor/Controllers/HealthController.cs +++ b/src/FrameProcessor/Controllers/HealthController.cs @@ -1,3 +1,4 @@ +using FrameProcessor.Mqtt; using Microsoft.AspNetCore.Mvc; namespace FrameProcessor.Controllers; @@ -6,6 +7,10 @@ namespace FrameProcessor.Controllers; [Route("health")] public class HealthController : ControllerBase { + private readonly MqttPublisher _mqtt; + + public HealthController(MqttPublisher mqtt) => _mqtt = mqtt; + [HttpGet] - public IActionResult Get() => Ok(new { status = "Healthy", mqttConnected = false }); + public IActionResult Get() => Ok(new { status = "Healthy", mqttConnected = _mqtt.IsConnected }); }