Automation and Shopify library updates
This commit is contained in:
@@ -4,6 +4,7 @@ using PartSource.Automation.Models.Configuration;
|
||||
using PartSource.Automation.Services;
|
||||
using Ratermania.Automation.Interfaces;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Automation.Jobs
|
||||
@@ -18,15 +19,17 @@ namespace PartSource.Automation.Jobs
|
||||
// TODO: set from config
|
||||
private readonly string[] _ssisPackages = { "Parts Price", "Parts Availability" };
|
||||
|
||||
public ExecuteSsisPackages(EmailService emailService, FtpService ftpService, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
||||
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
||||
{
|
||||
_ftpService = ftpService;
|
||||
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>();
|
||||
|
||||
_emailService = emailService;
|
||||
_ftpService = new FtpService(ftpConfiguration);
|
||||
_ssisService = ssisService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task Run()
|
||||
public async Task Run(CancellationToken token, params string[] arguments)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
@@ -37,12 +40,12 @@ namespace PartSource.Automation.Jobs
|
||||
_ftpService.Download($"{package}.txt");
|
||||
_ssisService.Execute($"{package}.dtsx");
|
||||
|
||||
_logger.LogInformation("Execution of SSIS package {package} completed successfully.", package);
|
||||
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Execution of SSIS package {package} failed", package);
|
||||
_logger.LogError($"Execution of SSIS package {package} failed.", ex);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user