Tweaks for stability
This commit is contained in:
@@ -24,7 +24,7 @@ namespace PartSource.Automation.Jobs
|
|||||||
|
|
||||||
public BulkUpdateInventory(IConfiguration configuration, ILogger<BulkUpdateInventory> logger)
|
public BulkUpdateInventory(IConfiguration configuration, ILogger<BulkUpdateInventory> logger)
|
||||||
{
|
{
|
||||||
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>();
|
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
|
||||||
_ftpService = new FtpService(ftpConfiguration);
|
_ftpService = new FtpService(ftpConfiguration);
|
||||||
|
|
||||||
_connectionString = configuration.GetConnectionString("PartSourceDatabase");
|
_connectionString = configuration.GetConnectionString("PartSourceDatabase");
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PartSource.Automation.Models.Configuration;
|
using PartSource.Automation.Models.Configuration;
|
||||||
|
using PartSource.Automation.Models.Ftp;
|
||||||
using PartSource.Automation.Services;
|
using PartSource.Automation.Services;
|
||||||
using Ratermania.Automation.Interfaces;
|
using Ratermania.Automation.Interfaces;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -21,7 +23,7 @@ namespace PartSource.Automation.Jobs
|
|||||||
|
|
||||||
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
||||||
{
|
{
|
||||||
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>();
|
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
|
||||||
|
|
||||||
_emailService = emailService;
|
_emailService = emailService;
|
||||||
_ftpService = new FtpService(ftpConfiguration);
|
_ftpService = new FtpService(ftpConfiguration);
|
||||||
@@ -36,7 +38,18 @@ namespace PartSource.Automation.Jobs
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ftpService.Download($"{package}.txt");
|
FtpFileInfo lastUploadedFile = _ftpService.ListFilesExtended()
|
||||||
|
.Where(f => f.FileType == FtpFileType.File && f.Filename.IndexOf(package) > -1)
|
||||||
|
.OrderByDescending(f => f.Modified)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (lastUploadedFile == null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"No {package} file available.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ftpService.Download($"{package}.txt");
|
||||||
_ssisService.Execute($"{package}.dtsx");
|
_ssisService.Execute($"{package}.dtsx");
|
||||||
|
|
||||||
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
|
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
|
||||||
@@ -45,7 +58,6 @@ namespace PartSource.Automation.Jobs
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError($"Execution of SSIS package {package} failed.", ex);
|
_logger.LogError($"Execution of SSIS package {package} failed.", ex);
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace PartSource.Automation.Jobs
|
|||||||
|
|
||||||
public PartialInventoryUpdate(IConfiguration configuration, ILogger<PartialInventoryUpdate> logger)
|
public PartialInventoryUpdate(IConfiguration configuration, ILogger<PartialInventoryUpdate> logger)
|
||||||
{
|
{
|
||||||
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>();
|
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
|
||||||
_ftpService = new FtpService(ftpConfiguration);
|
_ftpService = new FtpService(ftpConfiguration);
|
||||||
|
|
||||||
_connectionString = _connectionString = configuration.GetConnectionString("PartSourceDatabase");
|
_connectionString = _connectionString = configuration.GetConnectionString("PartSourceDatabase");
|
||||||
|
|||||||
@@ -11,19 +11,18 @@
|
|||||||
"SmtpHost": "localhost"
|
"SmtpHost": "localhost"
|
||||||
},
|
},
|
||||||
"FtpServers": {
|
"FtpServers": {
|
||||||
"AzureConfiguration": {
|
|
||||||
"Username": "ps-ftp\\$ps-ftp",
|
|
||||||
"Password": "ycvXptffBxqkBXW4vuRYqn4Zi1soCvnvMMolTe5HNSeAlcl3bAyJYtNhG579",
|
|
||||||
"Url": "ftp://waws-prod-yq1-007.ftp.azurewebsites.windows.net/site/wwwroot",
|
|
||||||
"Destination": "C:\\Partsource.Automation\\Downloads",
|
|
||||||
"Port": 21
|
|
||||||
},
|
|
||||||
"WhiConfiguration": {
|
"WhiConfiguration": {
|
||||||
"Username": "ctc_seo",
|
"Username": "ctc_seo",
|
||||||
"Password": "YD3gtaQ5kPdtNKs",
|
"Password": "YD3gtaQ5kPdtNKs",
|
||||||
"Url": "ftp://ftp.whisolutions.com",
|
"Url": "ftp://ftp.whisolutions.com",
|
||||||
"Destination": "C:\\Partsource.Automation\\Downloads\\WHI",
|
"Destination": "C:\\Partsource.Automation\\Downloads\\WHI",
|
||||||
"Port": 3001
|
"Port": 3001
|
||||||
|
},
|
||||||
|
"AutomationConfiguration": {
|
||||||
|
"Username": "stageuser",
|
||||||
|
"Password": "FXepK^cFYS|[H<",
|
||||||
|
"Url": "ftp://localhost",
|
||||||
|
"Destination": "C:\\Partsource.Automation\\Downloads"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ssisConfiguration": {
|
"ssisConfiguration": {
|
||||||
|
|||||||
Reference in New Issue
Block a user