Adding
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class BatchIngestionConsumer : IConsumer<BatchIngestionRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public BatchIngestionConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<BatchIngestionRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandleBatchIngestion.");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IBatchIngestionService>().HandleBatchIngestion(context.Message));
|
||||
Log.Debug("Starting HandleBatchIngestion.");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Batch Ingestion Failure. " +
|
||||
$"The Batch Ingestion Request is placed on LCU.DocumentIngestor.BatchIngestion_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Batch Ingestion Failure. " +
|
||||
$"The Batch Ingestion Request is placed on LCU.DocumentIngestor.BatchIngestion_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class BatchUpdateMemberNotificationDataConsumer : IConsumer<Batch<BatchUpdateMemberNotificationDataRequest>>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public BatchUpdateMemberNotificationDataConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<Batch<BatchUpdateMemberNotificationDataRequest>> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting BatchUpdateMemberNotificationData");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
|
||||
var batchUpdateMemberNotificationDataRequests = new List<BatchUpdateMemberNotificationDataRequest>();
|
||||
for (int index = 0; index < context.Message.Length; index++)
|
||||
{
|
||||
ConsumeContext<BatchUpdateMemberNotificationDataRequest> messageContext = context.Message[index];
|
||||
batchUpdateMemberNotificationDataRequests.Add(messageContext.Message);
|
||||
}
|
||||
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IBatchUpdateMemberNotificationDataService>().HandleBatchUpdateMemberNotificationData(batchUpdateMemberNotificationDataRequests));
|
||||
Log.Debug("Ending BatchUpdateMemberNotificationData");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Document Ingestor Failure. " +
|
||||
$"The BatchUpdateMemberNotificationDataRequest is placed on LCU.DocumentIngestor.BatchUpdateMemberNotificationData_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Document Ingestor Failure. " +
|
||||
$"The BatchUpdateMemberNotificationDataRequest is placed on LCU.DocumentIngestor.BatchUpdateMemberNotificationData_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class GatherMemberNotificationInfoConsumer : IConsumer<GatherMemberNotificationInfoRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public GatherMemberNotificationInfoConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<GatherMemberNotificationInfoRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting GatherMemberNotificationInfoRequest");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IGatherMemberNotificationInfoService>().HandleMemberNotificationInfoGathering(context.Message));
|
||||
Log.Debug("Ending GatherMemberNotificationInfoRequest");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Document Ingestor Failure. " +
|
||||
$"The GatherMemberNotificationInfoRequest is placed on LCU.DocumentIngestor.GatherMemberNotificationInfo_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Document Ingestor Failure. " +
|
||||
$"The GatherMemberNotificationInfoRequest is placed on LCU.DocumentIngestor.GatherMemberNotificationInfo_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Exceptions;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class IngestionFolderCleanUpConsumer : IConsumer<IngestionFolderCleanUpRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public IngestionFolderCleanUpConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<IngestionFolderCleanUpRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IIngestionFolderCleanUpService>().HandleIngestionFolderCleanUp(context.Message));
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"IngestionFolderCleanUp Failure. " +
|
||||
$"The Processing Request is placed on LCU.DocumentIngestor.IngestionFolderCleanUp_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected IngestionFolderCleanUp Failure. " +
|
||||
$"The Processing Request is placed on LCU.DocumentIngestor.IngestionFolderCleanUp_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using ApiResponse = LCU.Library.Internal.ApiResponse.Models;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class IngestorCompletionConsumer : IConsumer<Batch<ApiResponse.Response>>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public IngestorCompletionConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<Batch<ApiResponse.Response>> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandleCompletion");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
|
||||
var completionRequests = new List<ApiResponse.Response>();
|
||||
for (int index = 0; index < context.Message.Length; index++)
|
||||
{
|
||||
ConsumeContext<ApiResponse.Response> messageContext = context.Message[index];
|
||||
completionRequests.Add(messageContext.Message);
|
||||
}
|
||||
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<ICompletionService>().HandleCompletion(completionRequests));
|
||||
Log.Debug("Ending HandleCompletion");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Document Ingestor Failure. " +
|
||||
$"The List<ApiResponse.Response> is placed on LCU.DocumentIngestor.Completion_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Document Ingestor Failure. " +
|
||||
$"The List<ApiResponse.Response> is placed on LCU.DocumentIngestor.Completion_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class IngestorIndexConsumer : IConsumer<IngestorRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public IngestorIndexConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<IngestorRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandleIngestion.");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IIndexService>().HandleIngestion(context.Message));
|
||||
Log.Debug("Starting HandleIngestion.");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Document Ingestor Failure. " +
|
||||
$"The Document Ingestor Request is placed on LCU.DocumentIngestor.Indexing_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Document Ingestor Failure. " +
|
||||
$"The Document Upload Request is placed on LCU.DocumentIngestor.Indexing_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Exceptions;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class IngestorProcessingConsumer : IConsumer<ProcessingRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public IngestorProcessingConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<ProcessingRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IDocumentProcessorService>().HandleProcessing(context.Message));
|
||||
}
|
||||
catch (ArchiveException archiveException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(archiveException, $"Document Ingestor Failure. Failure to Archive!");
|
||||
throw;
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Document Ingestor Failure. " +
|
||||
$"The Processing Request is placed on LCU.DocumentIngestor.Processing_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Document Ingestor Failure. " +
|
||||
$"The Processing Request is placed on LCU.DocumentIngestor.Processing_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class MemberDocumentNotifierConsumer : IConsumer<MemberDocumentNotificationRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public MemberDocumentNotifierConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<MemberDocumentNotificationRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandleMemberDocumentNotification");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IMemberDocumentNotifierService>().HandleMemberDocumentNotification(context.Message));
|
||||
Log.Debug("Ending HandleMemberDocumentNotification");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Member Document Notifier Failure. " +
|
||||
$"The request is placed on LCU.DocumentIngestor.MemberDocumentNotifier_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Member Document Notifier Failure. " +
|
||||
$"The request is placed on LCU.DocumentIngestor.MemberDocumentNotifier_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using ApiResponse = LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class MemberNotificationCompletionConsumer : IConsumer<ApiResponse.Response>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public MemberNotificationCompletionConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<ApiResponse.Response> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandleMemberNotificationCompletion");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IMemberNotificationCompletionService>().HandleMemberNotificationCompletion(context.Message));
|
||||
Log.Debug("Ending HandleMemberNotificationCompletion");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, "Member Notification Completion Failure. " +
|
||||
"The request is placed on LCU.DocumentIngestor.MemberNotificationCompletion_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, "Unexpected Member Notification Completion Failure. " +
|
||||
"The request is placed on LCU.DocumentIngestor.MemberNotificationCompletion_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using ApiResponse = LCU.Library.Internal.ApiResponse.Models.Response;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class PdfPartitionerCompletionConsumer : IConsumer<ApiResponse>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public PdfPartitionerCompletionConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<ApiResponse> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandlePdfPartitionerCompletion.");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IPdfPartitionerCompletionService>().HandlePdfPartitionerCompletion(context.Message));
|
||||
Log.Debug("Starting HandlePdfPartitionerCompletion.");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Handle Pdf Partitioner Completion Failure. " +
|
||||
$"The Pdf Partitioner Response is placed on LCU.DocumentIngestor.PdfPartitioner.Completion_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Pdf Partitioner Completion Failure. " +
|
||||
$"The Pdf Partitioner Response is placed on LCU.DocumentIngestor.PdfPartitioner.Completion_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class PdfPartitionerConsumer : IConsumer<PdfPartitionerRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public PdfPartitionerConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<PdfPartitionerRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandlePdfPartitioner.");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IPdfPartitionerService>().HandlePdfPartition(context.Message));
|
||||
Log.Debug("Starting HandleIngestorPdfPartitioner.");
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Handle Pdf Partitioner Failure. " +
|
||||
$"The Pdf Partitioner Request is placed on LCU.DocumentIngestor.PdfPartitioner_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Pdf Partitioner Failure. " +
|
||||
$"The Pdf Partitioner Request is placed on LCU.DocumentIngestor.PdfPartitioner_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Requests;
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class ProcessStatusTypeEmailConsumer : IConsumer<ProcessStatusTypeEmailRequest>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public ProcessStatusTypeEmailConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<ProcessStatusTypeEmailRequest> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Information("ProcessStatusType Email Consumer Listening");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
await Task.Run(() => scope.ServiceProvider.GetRequiredService<IProcessStatusTypeEmailService>().HandleProcessStatusTypeEmailRequest(context.Message));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Process Status Email Consumer Failure. " +
|
||||
$"The List<ApiResponse.Response> is placed on LCU.DocumentIngestor.ProcessStatusTypeEmail.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
using MassTransit;
|
||||
using Serilog;
|
||||
using LCU.Library.Internal.Exceptions;
|
||||
using LCU.Api.Internal.MaidBotLib.Models;
|
||||
using LCU.API.Internal.DocumentIngestor.Services.IngestionOperationServices;
|
||||
using ApiResponse = LCU.Library.Internal.ApiResponse.Models;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Exceptions;
|
||||
using Response = LCU.Library.Internal.ApiResponse.Models.Response;
|
||||
namespace LCU.API.Internal.DocumentIngestor.Consumers;
|
||||
|
||||
public class UploadCompletionConsumer : IConsumer<Batch<ApiResponse.Response>>
|
||||
{
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
|
||||
public UploadCompletionConsumer(IServiceScopeFactory scopeFactory)
|
||||
{
|
||||
_scopeFactory = scopeFactory;
|
||||
}
|
||||
|
||||
public async Task Consume(ConsumeContext<Batch<ApiResponse.Response>> context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Debug("Starting HandleUploadCompletion");
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
|
||||
var uploadCompletionRequests = new List<Response>();
|
||||
for (int index = 0; index < context.Message.Length; index++)
|
||||
{
|
||||
ConsumeContext<Response> messageContext = context.Message[index];
|
||||
uploadCompletionRequests.Add(messageContext.Message);
|
||||
}
|
||||
|
||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IUploadCompletionService>().HandleUploadCompletion(uploadCompletionRequests));
|
||||
Log.Debug("Ending HandleUploadCompletion");
|
||||
}
|
||||
catch (ArchiveException archiveException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(archiveException, $"Upload Completion Failure. Failure to Archive!");
|
||||
throw;
|
||||
}
|
||||
catch (ServiceException serviceException)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Error(serviceException, $"Upload Completion Failure. " +
|
||||
$"The List<ApiResponse.Response> is placed on LCU.DocumentIngestor.UploadCompletion_error.");
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
||||
.Fatal(exception, $"Unexpected Upload Completion Failure. " +
|
||||
$"The List<ApiResponse.Response> is placed on LCU.DocumentIngestor.UploadCompletion_error.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user