This commit is contained in:
Zeeshaun
2026-03-17 10:03:23 -05:00
parent 1a0702a79a
commit bd1a9744ad
139 changed files with 5388 additions and 0 deletions
@@ -0,0 +1,36 @@
using System;
using System.Threading.Tasks;
using Serilog;
using Microsoft.Extensions.DependencyInjection;
using MassTransit;
using LCU.Library.Internal.ArchiverApiModel.Models;
using LCU.Api.Internal.ArchiverApi.Services;
using LCU.Library.Internal.Exceptions;
namespace LCU.Api.Internal.ArchiverApi.Consumers;
public class ArchiverConsumer : IConsumer<ArchiveRequest>
{
private readonly IServiceScopeFactory _scopeFactory;
public ArchiverConsumer(IServiceScopeFactory scopeFactory)
{
_scopeFactory = scopeFactory;
}
public async Task Consume(ConsumeContext<ArchiveRequest> context)
{
try
{
using var scope = _scopeFactory.CreateScope();
await Task.Run(() => scope.ServiceProvider.GetRequiredService<IArchiverService>().ExecuteRequest(context.Message));
}
catch (ServiceException)
{
return;
}
catch (Exception exception)
{
Log.Fatal(exception, $"Unexpected Failure");
}
}
}
@@ -0,0 +1,36 @@
using System;
using System.Threading.Tasks;
using Serilog;
using Microsoft.Extensions.DependencyInjection;
using MassTransit;
using LCU.Api.Internal.ArchiverApi.Services;
using ApiResponse = LCU.Library.Internal.ApiResponse.Models;
using LCU.Library.Internal.Exceptions;
namespace LCU.Api.Internal.ArchiverApi.Consumers;
public class ResponseConsumer : IConsumer<ApiResponse.Response>
{
private readonly IServiceScopeFactory _scopeFactory;
public ResponseConsumer(IServiceScopeFactory scopeFactory)
{
_scopeFactory = scopeFactory;
}
public async Task Consume(ConsumeContext<ApiResponse.Response> context)
{
try
{
using var scope = _scopeFactory.CreateScope();
await Task.Run(() => scope.ServiceProvider.GetRequiredService<IArchiveCompletionService>().HandleReportArchiveCompletedRequest(context.Message));
}
catch (ServiceException)
{
return;
}
catch (Exception exception)
{
Log.Fatal(exception, $"Unexpected Failure");
}
}
}