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) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 15:20:21 +02:00
parent 948515c9bf
commit 0f681753c1
2 changed files with 7 additions and 2 deletions

View File

@@ -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

View File

@@ -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 });
}