feat: Сервисы и модели RabbitMq разнесены согласно архитектуры
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Domain.Mq;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
using PARR.Domain.Enums;
|
||||
using PARR.JobAutoControl.Settings;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PARR.JobAutoControl
|
||||
{
|
||||
@@ -44,10 +44,10 @@ namespace PARR.JobAutoControl
|
||||
//using (var scope = serviceProvider.CreateScope())
|
||||
{
|
||||
var jobAutoControlService = scope.ServiceProvider.GetService<IJobAutoControlService>();
|
||||
var mqService = scope.ServiceProvider.GetService<IMqService>();
|
||||
var mqService = scope.ServiceProvider.GetService<IRabbitService>();
|
||||
|
||||
if (jobAutoControlService == null || mqService == null)
|
||||
throw new Exception($"Не смог получить серивс {nameof(IJobAutoControlService)} или {nameof(IMqService)}");
|
||||
throw new Exception($"Не смог получить серивс {nameof(IJobAutoControlService)} или {nameof(IRabbitService)}");
|
||||
|
||||
await HandlerAsync(jobAutoControlService, mqService);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace PARR.JobAutoControl
|
||||
}
|
||||
|
||||
|
||||
private async Task HandlerAsync(IJobAutoControlService jobAutoControlService, IMqService mqService)
|
||||
private async Task HandlerAsync(IJobAutoControlService jobAutoControlService, IRabbitService mqService)
|
||||
{
|
||||
var jobsWithAutoControl = await jobAutoControlService.Get().Where(t => t.IsEnable).ToListAsync();
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace PARR.JobAutoControl
|
||||
// формируем сообщения
|
||||
var msgList = jobsWithAutoControl.Select(t => new TemplateMatcherMq
|
||||
{
|
||||
Action = Constants.TemplateMatcherActionEnum.Sync,
|
||||
EntityType = Constants.SyncTaskEntityTypeEnum.Job,
|
||||
Action = TemplateMatcherActionEnum.Sync,
|
||||
EntityType = SyncTaskEntityTypeEnum.Job,
|
||||
Id = t.JobId,
|
||||
Initiator = new HistoryInitiator
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Constants\PARR.Constants.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using PARR.BLL.Contracts.Interfaces;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.JobAutoControl.Settings
|
||||
{
|
||||
@@ -9,11 +9,11 @@ namespace PARR.JobAutoControl.Settings
|
||||
|
||||
internal class TemplateMatcher : IMqSettings
|
||||
{
|
||||
public string HostName { get; set; } = string.Empty;
|
||||
public string QueueName { get; set; } = string.Empty;
|
||||
public string User { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public ushort? PrefetchCount { get; set; } = 0;
|
||||
public string HostName { get; init; } = string.Empty;
|
||||
public string QueueName { get; init; } = string.Empty;
|
||||
public string User { get; init; } = string.Empty;
|
||||
public string Password { get; init; } = string.Empty;
|
||||
public ushort? PrefetchCount { get; init; } = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user