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:
@@ -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
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user