/// <summary>
        /// Initializes a new instance of the <see cref="StopWorker"/> class.
        /// </summary>
        /// <param name="cancelWorkSource">The cancel work source.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="waitForEventOrCancel">The wait for event or cancel.</param>
        public StopWorker(IQueueCancelWork cancelWorkSource,
                          IWorkerConfiguration configuration,
                          ILogFactory log,
                          IWorkerWaitForEventOrCancel waitForEventOrCancel)
        {
            Guard.NotNull(() => cancelWorkSource, cancelWorkSource);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => waitForEventOrCancel, waitForEventOrCancel);

            _cancelWorkSource = cancelWorkSource;
            _configuration    = configuration;
            _log = log.Create();
            _waitForEventOrCancel = waitForEventOrCancel;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StopWorker"/> class.
        /// </summary>
        /// <param name="cancelWorkSource">The cancel work source.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="log">The log.</param>
        /// <param name="waitForEventOrCancel">The wait for event or cancel.</param>
        public StopWorker(IQueueCancelWork cancelWorkSource,
            IWorkerConfiguration configuration,
            ILogFactory log,
            IWorkerWaitForEventOrCancel waitForEventOrCancel)
        {
            Guard.NotNull(() => cancelWorkSource, cancelWorkSource);
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => waitForEventOrCancel, waitForEventOrCancel);

            _cancelWorkSource = cancelWorkSource;
            _configuration = configuration;
            _log = log.Create();
            _waitForEventOrCancel = waitForEventOrCancel;
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkerCollection"/> class.
        /// </summary>
        /// <param name="workerConfiguration">The worker configuration.</param>
        /// <param name="workerFactory">The worker factory.</param>
        /// <param name="stopWorker">The stop worker.</param>
        /// <param name="log">The log.</param>
        /// <param name="workerPause">The worker pause.</param>
        public WorkerCollection(IWorkerConfiguration workerConfiguration,
                                IWorkerFactory workerFactory,
                                StopWorker stopWorker,
                                ILogFactory log,
                                IWorkerWaitForEventOrCancel workerPause)
        {
            Guard.NotNull(() => workerConfiguration, workerConfiguration);
            Guard.NotNull(() => workerFactory, workerFactory);
            Guard.NotNull(() => stopWorker, stopWorker);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => workerPause, workerPause);

            _workerConfiguration = workerConfiguration;
            _workerFactory       = workerFactory;
            _stopWorker          = stopWorker;
            _log         = log.Create();
            _workerPause = workerPause;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkerCollection"/> class.
        /// </summary>
        /// <param name="workerConfiguration">The worker configuration.</param>
        /// <param name="workerFactory">The worker factory.</param>
        /// <param name="stopWorker">The stop worker.</param>
        /// <param name="log">The log.</param>
        /// <param name="workerPause">The worker pause.</param>
        public WorkerCollection(IWorkerConfiguration workerConfiguration,
            IWorkerFactory workerFactory,
            StopWorker stopWorker,
            ILogFactory log,
            IWorkerWaitForEventOrCancel workerPause)
        {
            Guard.NotNull(() => workerConfiguration, workerConfiguration);
            Guard.NotNull(() => workerFactory, workerFactory);
            Guard.NotNull(() => stopWorker, stopWorker);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => workerPause, workerPause);

            _workerConfiguration = workerConfiguration;
            _workerFactory = workerFactory;
            _stopWorker = stopWorker;
            _log = log.Create();
            _workerPause = workerPause;
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Worker" /> class.
        /// </summary>
        /// <param name="nameFactory">The name factory.</param>
        /// <param name="pauseEvent">The pause event.</param>
        /// <param name="log">The log.</param>
        /// <param name="messageProcessing">The message processing.</param>
        /// <param name="workerTerminate">The worker terminate.</param>
        /// <param name="stopThread">The stop thread.</param>
        public Worker(
            IWorkerNameFactory nameFactory,
            IWorkerWaitForEventOrCancel pauseEvent,
            ILogFactory log,
            IMessageProcessingFactory messageProcessing,
            WorkerTerminate workerTerminate,
            StopThread stopThread)
            : base(workerTerminate, stopThread)
        {
            Guard.NotNull(() => pauseEvent, pauseEvent);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => nameFactory, nameFactory);

            _pauseEvent  = pauseEvent;
            _log         = log.Create();
            _nameFactory = nameFactory;
            _messageProcessingFactory = messageProcessing;
            IdleStatus = WorkerIdleStatus.Unknown;
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Worker" /> class.
        /// </summary>
        /// <param name="nameFactory">The name factory.</param>
        /// <param name="pauseEvent">The pause event.</param>
        /// <param name="log">The log.</param>
        /// <param name="messageProcessing">The message processing.</param>
        /// <param name="workerTerminate">The worker terminate.</param>
        /// <param name="stopThead">The stop thread.</param>
        public Worker(
            IWorkerNameFactory nameFactory,
            IWorkerWaitForEventOrCancel pauseEvent,
            ILogFactory log,
            IMessageProcessingFactory messageProcessing,
            WorkerTerminate workerTerminate,
            StopThread stopThead)
            : base(workerTerminate, stopThead)
        {
            Guard.NotNull(() => pauseEvent, pauseEvent);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => nameFactory, nameFactory);

            _pauseEvent = pauseEvent;
            _log = log.Create();
            _nameFactory = nameFactory;
            _messageProcessingFactory = messageProcessing;
            IdleStatus = WorkerIdleStatus.Unknown;
        }