feat(bll, all): обновлена библиотека RabbitMq.Client до версии 7.1.2. Обновлен MqServiceV2. В IMqSettings добавлен параметр PrefetchCount - макс кол-во одновременных обработок очередей. Обновлены связанные проекты под новый MqService. В проектах Aihit, SyncTemplate, SyncSchedule установлен параметр в конфиг PrefetchCount =100
This commit is contained in:
@@ -53,7 +53,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var msg = JsonSerializer.Serialize(requestToMq);
|
||||
|
||||
var sendResult = mqService.Send(mqSettings.TemplateDistributor, new[] { msg });
|
||||
var sendResult = await mqService.SendAsync(mqSettings.TemplateDistributor, new[] { msg });
|
||||
|
||||
if (sendResult.IsSuccess)
|
||||
return Created("", new Response<string?>(null, true, new List<ErrorModel>(), "Отправлен запрос на перераспределение регламентных работ."));
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
request.Ek.ForEach(ek =>
|
||||
{
|
||||
request.Status.ForEach(status =>
|
||||
//todo: проверить в ForEach(async status - отрабатывает ли нормально async, возможно надо переделать в обычный foreach
|
||||
request.Status.ForEach(async status =>
|
||||
{
|
||||
var obj = new GeneratorTemplateMq
|
||||
{
|
||||
@@ -70,7 +71,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var msg = JsonSerializer.Serialize(obj);
|
||||
|
||||
var _result = mqService.Send(mqSettings.GenerateTemplates, new[] { msg });
|
||||
var _result = await mqService.SendAsync(mqSettings.GenerateTemplates, new[] { msg });
|
||||
|
||||
if (_result.IsSuccess == false)
|
||||
result = false;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var msg = JsonSerializer.Serialize(mqRequest);
|
||||
|
||||
var sendResult = mqService.Send(mqSettings.TemplateActivator, new[] { msg });
|
||||
var sendResult = await mqService.SendAsync(mqSettings.TemplateActivator, new[] { msg });
|
||||
|
||||
if (!sendResult.IsSuccess)
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Ошибка при отправке данных." } }));
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="RabbitMQ.Client" Version="6.5.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace PARR.API.Settings
|
||||
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
|
||||
@@ -24,6 +25,7 @@ namespace PARR.API.Settings
|
||||
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
|
||||
@@ -32,6 +34,7 @@ namespace PARR.API.Settings
|
||||
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 MqStatistics
|
||||
@@ -45,5 +48,6 @@ namespace PARR.API.Settings
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user