From 6f9fa8011fcdbcaad8a2ae73fac7c2bb71c1f843 Mon Sep 17 00:00:00 2001 From: Julia Ilasova <1julka1il@gmail.com> Date: Wed, 5 Jun 2024 12:54:09 +0200 Subject: [PATCH] small mqtt subscriber changes --- api/Core/Services/MqttSubscriberService.cs | 2 ++ api/Program.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/api/Core/Services/MqttSubscriberService.cs b/api/Core/Services/MqttSubscriberService.cs index 13a0226..0c4db50 100644 --- a/api/Core/Services/MqttSubscriberService.cs +++ b/api/Core/Services/MqttSubscriberService.cs @@ -54,5 +54,7 @@ public async Task SubscribeAsync() f => { f.WithTopic(_options.Value.SubscribeTopic); }).Build(); await mqttClient.SubscribeAsync(mqttSubscribeOptions, CancellationToken.None); + + Console.ReadLine(); } } \ No newline at end of file diff --git a/api/Program.cs b/api/Program.cs index 888995d..99e1ec8 100644 --- a/api/Program.cs +++ b/api/Program.cs @@ -82,6 +82,7 @@ public static async Task StartApi(string[] args) var services = builder.FindAndInjectClientEventHandlers(Assembly.GetExecutingAssembly()); var app = builder.Build(); + await app.Services.GetRequiredService().SubscribeAsync(); // be careful with using --db-init on production, it will delete all data if (args.Contains("--db-init"))