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:
1 parent
521c95c10b
commit
a6c750d5c4
3 files changed
+136
-1
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using FrameProcessor.Configuration;
|
||||
using FrameProcessor.ImagePipeline;
|
||||
using FrameProcessor.Mqtt;
|
||||
using FrameProcessor.Storage;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -38,6 +39,8 @@ builder.Services.AddSingleton<FramesOptionsValidator>();
|
||||
builder.Services.AddSingleton<FramesRegistry>();
|
||||
builder.Services.AddSingleton<IImagePipeline, FrameProcessor.ImagePipeline.ImagePipeline>();
|
||||
builder.Services.AddSingleton<ImageStore>();
|
||||
builder.Services.AddSingleton<MqttPublisher>();
|
||||
builder.Services.AddHostedService(sp => sp.GetRequiredService<MqttPublisher>());
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
Reference in new issue
Block a user