feat(dal): TaskManagementService - создать задачу в БД и отправить в очередь
This commit is contained in:
@@ -4,6 +4,7 @@ using PARR.API.Contracts.V1;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.DAL.NextRunServices;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
@@ -23,7 +24,8 @@ namespace PARR.API.Controllers.V1
|
||||
IClientService clientService,
|
||||
IRedisCacheService redisCacheService,
|
||||
INextRunService nextRunService,
|
||||
ITemplateService templateService
|
||||
ITemplateService templateService,
|
||||
MqSettings mqSettings
|
||||
)
|
||||
{
|
||||
this.clientService = clientService;
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Промежуток времени, если робот не доступен, не считаем это ошибкой
|
||||
/// </summary>
|
||||
public TimeSpan InaccessibilityTime { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +1,22 @@
|
||||
using PARR.BLL.Contracts.Interfaces;
|
||||
using PARR.DAL.Contracts;
|
||||
|
||||
namespace PARR.API.Settings
|
||||
{
|
||||
public class MqSettings
|
||||
{
|
||||
public MqGenerateTemplates GenerateTemplates { get; set; } = new MqGenerateTemplates();
|
||||
public MqTemplateDistributor TemplateDistributor { get; set; } = new MqTemplateDistributor();
|
||||
public MqTemplateActivator TemplateActivator { get; set; } = new MqTemplateActivator();
|
||||
public MqSettingsBase GenerateTemplates { get; set; } = new();
|
||||
public MqSettingsBase TemplateDistributor { get; set; } = new();
|
||||
public MqSettingsBase TemplateActivator { get; set; } = new();
|
||||
public MqStatistics Statistics { get; set; } = new MqStatistics();
|
||||
public MqTemplatesMatcher TemplatesMatcher { get; set; } = new MqTemplatesMatcher();
|
||||
public MqTemplatesUpdater TemplatesUpdater { get; set; } = new MqTemplatesUpdater();
|
||||
public MqNextRun NextRun { get; set; } = new MqNextRun();
|
||||
}
|
||||
public MqSettingsBase TemplatesMatcher { get; set; } = new();
|
||||
public MqSettingsBase TemplatesUpdater { get; set; } = new();
|
||||
public MqSettingsBase NextRun { get; set; } = new();
|
||||
|
||||
public class MqGenerateTemplates : 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 class MqTemplateDistributor : 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 class MqTemplateActivator : 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;
|
||||
/// <summary>
|
||||
/// Настройки MQ для задач
|
||||
/// </summary>
|
||||
public Dictionary<TaskTypeEnum, MqSettingsBase> Tasks { get; set; } = new();
|
||||
}
|
||||
|
||||
public class MqStatistics
|
||||
@@ -54,30 +33,4 @@ namespace PARR.API.Settings
|
||||
public ushort? PrefetchCount { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class MqTemplatesMatcher : 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 class MqTemplatesUpdater : 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 class MqNextRun : 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
"NextRun": {
|
||||
"HostName": "10.99.253.216"
|
||||
},
|
||||
"Tasks": {
|
||||
"Workload": {
|
||||
"HostName": "10.99.253.216"
|
||||
}
|
||||
},
|
||||
"Statistics": {
|
||||
"StatMqAuth": {
|
||||
"HostName": "10.99.253.216"
|
||||
|
||||
@@ -66,6 +66,14 @@
|
||||
"User": "next_run_updater_writer",
|
||||
"Password": "KJHGfdsjfhg$976412!kay"
|
||||
},
|
||||
"Tasks": {
|
||||
"Workload": {
|
||||
"HostName": "parr-rabbitmq",
|
||||
"QueueName": "parr-task-workload",
|
||||
"User": "task_workload_writer",
|
||||
"Password": "UFtsduifytIUR$^85382Wt1few"
|
||||
}
|
||||
},
|
||||
"Statistics": {
|
||||
"StatMqAuth": {
|
||||
"HostName": "parr-rabbitmq",
|
||||
|
||||
Reference in New Issue
Block a user