| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- using Microsoft.CodeAnalysis.CSharp.Syntax;
- using Quadarax.Application.QLiberace.Common.Attributes;
- using Quadarax.Application.QLiberace.Common.Settings;
- using Quadarax.Application.QLiberace.Processor.Services;
- using Quadarax.Application.QLiberace.Processor.Workers;
- using Quadarax.Foundation.Core.Business.Interface;
- namespace Quadarax.Application.QLiberace.Processor.Settings
- {
- [Module(Base.Constants.Modules.Processor.Code)]
- public class ProcessorSetting : ModuleSetting
- {
- /// <summary>
- /// Defines number of <see cref="ProcessorWorkerService"/> working parallel
- /// </summary>
- public int Workers { get; set; }
- /// <summary>
- /// Defines number of <see cref="ProcessingWorker"/> working under one instance of <see cref="ProcessorWorkerService"/>
- /// </summary>
- public int ProcessingThreadsPerWorker { get; set; }
- /// <summary>
- /// Default processing worker PWI (Process Worker Identifier)
- /// </summary>
- public string ProcessingWorkerPwi { get; set; } = null!;
- /// <summary>
- /// Defines processing worker iteration interval (between two steps)
- /// </summary>
- public TimeSpan ProcessingWorkerInterval { get; set; }
- /// <summary>
- /// Defines processing worker iteration timeout (maximal iteration duration)
- /// </summary>
- public TimeSpan ProcessingWorkerTimeout { get; set; }
- /// <summary>
- /// Defines processing worker start delay two instances of worker (for fine tuning synchronization)
- /// </summary>
- public TimeSpan ProcessingWorkerDelay { get; set; }
- /// <summary>
- /// Defines number of <see cref="GarbageWorker"/> working under one instance of <see cref="ProcessorWorkerService"/>
- /// </summary>
- public int GarbageThreadsPerWorker { get; set; }
- /// <summary>
- /// Default garbage worker PWI (Process Worker Identifier)
- /// </summary>
- public string GarbageWorkerPwi { get; set; } = null!;
- /// <summary>
- /// Defines garbage worker iteration interval (between two steps)
- /// </summary>
- public TimeSpan GarbageWorkerInterval { get; set; }
- /// <summary>
- /// Defines garbage worker iteration timeout (maximal iteration duration)
- /// </summary>
- public TimeSpan GarbageWorkerTimeout { get; set; }
- /// <summary>
- /// Defines garbage worker start delay two instances of worker (for fine tuning synchronization)
- /// </summary>
- public TimeSpan GarbageWorkerDelay { get; set; }
- /// <summary>
- /// Defines number of <see cref="RetentionWorker"/> working under one instance of <see cref="ProcessorWorkerService"/>
- /// </summary>
- public int RetentionThreadsPerWorker { get; set; }
- /// <summary>
- /// Default retention worker PWI (Process Worker Identifier)
- /// </summary>
- public string RetentionWorkerPwi { get; set; } = null!;
- /// <summary>
- /// Defines retention worker iteration interval (between two steps)
- /// </summary>
- public TimeSpan RetentionWorkerInterval { get; set; }
- /// <summary>
- /// Defines retention worker iteration timeout (maximal iteration duration)
- /// </summary>
- public TimeSpan RetentionWorkerTimeout { get; set; }
- /// <summary>
- /// Defines retention worker start delay between two instances of worker (for fine tuning synchronization)
- /// </summary>
- public TimeSpan RetentionWorkerDelay { get; set; }
- #region *** Operations ***
- public IWorkerSettings GetProcessingWorkerSettings()
- {
- return new WorkerSettings()
- {
- Interval = ProcessingWorkerInterval,
- IterationTimeout = ProcessingWorkerTimeout,
- StartDelay = ProcessingWorkerDelay,
- WorkerCount = ProcessingThreadsPerWorker,
- WorkerNamePrefix = ProcessingWorkerPwi
- };
- }
- public IWorkerSettings GetGarbageWorkerSettings()
- {
- return new WorkerSettings()
- {
- Interval = GarbageWorkerInterval,
- IterationTimeout = GarbageWorkerTimeout,
- StartDelay = GarbageWorkerDelay,
- WorkerCount = GarbageThreadsPerWorker,
- WorkerNamePrefix = GarbageWorkerPwi
- };
- }
- public IWorkerSettings GetRetentionWorkerSettings()
- {
- return new WorkerSettings()
- {
- Interval = RetentionWorkerInterval,
- IterationTimeout = RetentionWorkerTimeout,
- StartDelay = RetentionWorkerDelay,
- WorkerCount = RetentionThreadsPerWorker,
- WorkerNamePrefix = RetentionWorkerPwi
- };
- }
- public override void SetDefaults()
- {
- Workers = Constants.Modules.Processor.ProcessorServiceCount;
- ProcessingThreadsPerWorker = Constants.Modules.Processor.ProcessingThreads;
- ProcessingWorkerPwi = Constants.Modules.Processor.PrefixProcessing;
- ProcessingWorkerInterval = TimeSpan.Parse(Constants.Modules.Processor.ProcessingInterval);
- ProcessingWorkerTimeout= TimeSpan.Parse(Constants.Modules.Processor.ProcessingTimeout);
- ProcessingWorkerDelay = TimeSpan.Parse(Constants.Modules.Processor.ProcessingDelay);
- GarbageThreadsPerWorker= Constants.Modules.Processor.GarbageThreads;
- GarbageWorkerPwi = Constants.Modules.Processor.PrefixGarbage;
- GarbageWorkerInterval= TimeSpan.Parse(Constants.Modules.Processor.GarbageInterval);
- GarbageWorkerTimeout = TimeSpan.Parse(Constants.Modules.Processor.GarbageTimeout);
- GarbageWorkerDelay= TimeSpan.Parse(Constants.Modules.Processor.GarbageDelay);
- RetentionThreadsPerWorker = Constants.Modules.Processor.RetentionThreads;
- RetentionWorkerPwi = Constants.Modules.Processor.PrefixRetention;
- RetentionWorkerInterval = TimeSpan.Parse(Constants.Modules.Processor.RetentionInterval);
- RetentionWorkerTimeout= TimeSpan.Parse(Constants.Modules.Processor.RetentionTimeout);
- RetentionWorkerDelay= TimeSpan.Parse(Constants.Modules.Processor.RetentionDelay);
- }
- #endregion
- #region *** Private operations ***
- #endregion
- #region *** Nested classes ***
- #endregion
- }
- }
|