using System.Collections.Generic; using System.IO.Abstractions; using System.Threading.Tasks; using BO.ProcessServer.Business.StatisticCounters; using BO.ProcessServer.Business.Workers.Contexts; using BO.ProcessServer.Options; using Connector.PS; using Quadarax.Foundation.Core.Logging; using Quadarax.Foundation.Core.Thread; namespace BO.ProcessServer.Business.Workers { internal class ProcessingDocumentsWorker: LoopWorker { private const string CS_WK_NAME = "ProcessingDocument"; public ProcessingDocumentsWorker(Configuration configuration,IList processes, Connection connection, IFileSystem fileSystem,Statistics statistics, Pool pool, ILogger logger) : base(CS_WK_NAME, new ProcessingDocumentsCtx(configuration, processes, connection, fileSystem, statistics, pool), logger) { } public ProcessingDocumentsWorker(string workerName) : base(workerName) { } public ProcessingDocumentsWorker(string workerName, IWorkerContext context, ILogger logger = null) : base(workerName, context, logger) { } protected override async Task DoIteration(IWorkerContext context) { var ctx = (ProcessingDocumentsCtx)context; // ensure connection if (!ctx.Connection.IsOpen) ctx.Connection.Open(ctx.Configuration.ApiUser, ctx.Configuration.ApiUserPwd, ctx.Configuration.ApiMagic); } } }