This commit is contained in:
Zeeshaun
2026-03-24 15:28:37 -05:00
parent 9cc87337b8
commit 73d62efb39
58 changed files with 2952 additions and 0 deletions
@@ -0,0 +1,42 @@
using System;
using Newtonsoft.Json;
using Serilog;
using MassTransit;
using LCU.Api.Internal.FTP.Configuration;
using LCU.Api.Internal.FTPLib.Models.Enums;
using LCU.Api.Internal.FTPLib.Models;
using LCU.Library.Internal.Exceptions;
using LCU.Library.Internal.LcuMassTransitModels;
namespace LCU.Api.Internal.FTP.Services;
public class QueueSshFtpService : IQueueSshFtpService
{
private readonly ISendEndpoint _sendEndpoint;
public QueueSshFtpService(IBusControl busControl, ReceiveEndpointConfiguration receiveEndpointsConfiguration)
{
_sendEndpoint = busControl.GetSendEndpoint(receiveEndpointsConfiguration.ReceiveEndpointUri).Result;
}
public void QueueSshFtpRequest(SshFtpRequest request)
{
try
{
var queueRequest = new QueueRequest();
queueRequest = new QueueRequest()
{
Request = JsonConvert.SerializeObject(request),
FtpType = FtpType.SshFtp
};
_sendEndpoint.Send(queueRequest);
Log.Debug($"Queued ssh ftp request to host {request.HostName}");
}
catch (Exception ex)
{
Log.Error(ex, $"Failed to queue ssh ftp request to host {request.HostName}");
throw new ServiceException($"Failed to queue ssh ftp request to host {request.HostName}");
}
}
}