Files
parr_api/PARR.GeneratorTemplates/GeneratorTemplate.cs
Mikhail Trubnikov cff93be36a mq dispose
2023-09-21 16:38:38 +10:00

43 lines
1.0 KiB
C#

using Microsoft.Extensions.Logging;
using PARR.BLL.Services.Interfaces;
using PARR.GeneratorTemplates.Settings;
namespace PARR.GeneratorTemplates
{
internal class GeneratorTemplate : IGeneratorTemplate
{
private readonly MqSettings mqSettings;
private readonly IMqService mqService;
private readonly ILogger<GeneratorTemplate> logger;
public GeneratorTemplate(
MqSettings mqSettings,
IMqService mqService,
ILogger<GeneratorTemplate> logger
)
{
this.mqSettings = mqSettings;
this.mqService = mqService;
this.logger = logger;
}
public void Start()
{
mqService.Received += (msg) =>
{
logger.LogInformation($"Привет откуда надо!!! ${msg}");
//todo: идем дальеш!
};
mqService.InitConsumer(mqSettings);
}
public void Stop()
{
mqService.Dispose();
}
}
}