You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

1 year ago
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Threading;
using Volo.Abp.Uow;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent;
1 year ago
public class InjectionMoldingTaskOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
{
private readonly string Outgoing = "InjectionMoldingTaskOptions Outgoing";
private readonly IOptions<InjectionMoldingTaskOptions> _options;
public InjectionMoldingTaskOutgoingBackgroundWorker(
AbpAsyncTimer timer
, IOptions<InjectionMoldingTaskOptions> options
, IServiceScopeFactory serviceScopeFactory
) : base(timer, serviceScopeFactory)
{
_options = options;
Timer.Period = options.Value.OutgoingOptions.PeriodSeconds * 1000; //default 10 minutes
}
[UnitOfWork]
protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
{
Logger.LogInformation($"Starting: Handling {Outgoing}");
if (!_options.Value.IncomingOptions.Active)
{
Logger.LogInformation($"{Outgoing} is not active!");
return;
}
Logger.LogInformation($"Write Issue");
//var issueConvert = workerContext.ServiceProvider.GetRequiredService<IssuesConverter>();
//var issueNoteList = await issueConvert.ConvertAsync().ConfigureAwait(false);
//var issueWriter = workerContext.ServiceProvider.GetRequiredService<IssueNoteWriter>();
//await issueWriter.WriteAsync(issueNoteList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Outgoing}");
}
}