Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PrimaryWorker" /> class.
        /// </summary>
        /// <param name="nameFactory">The name factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="messageProcessing">The message processing.</param>
        /// <param name="workerTerminate">The worker terminate.</param>
        /// <param name="workerCollection">The worker collection.</param>
        /// <param name="stopThread">The stop thread.</param>
        public PrimaryWorker(
            IWorkerNameFactory nameFactory,
            ILogger log,
            IMessageProcessingFactory messageProcessing,
            WorkerTerminate workerTerminate,
            IWorkerCollection workerCollection,
            StopThread stopThread)
            : base(workerTerminate, stopThread)
        {
            Guard.NotNull(() => nameFactory, nameFactory);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => messageProcessing, messageProcessing);
            Guard.NotNull(() => workerTerminate, workerTerminate);
            Guard.NotNull(() => workerCollection, workerCollection);

            _log         = log;
            _nameFactory = nameFactory;
            _messageProcessingFactory = messageProcessing;
            _workerCollection         = workerCollection;

            IdleStatus = WorkerIdleStatus.Unknown;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PrimaryWorker" /> class.
        /// </summary>
        /// <param name="nameFactory">The name factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="messageProcessing">The message processing.</param>
        /// <param name="workerTerminate">The worker terminate.</param>
        /// <param name="workerCollection">The worker collection.</param>
        /// <param name="stopThead">The stop thread.</param>
        public PrimaryWorker(
            IWorkerNameFactory nameFactory,
            ILogFactory log,
            IMessageProcessingFactory messageProcessing,
            WorkerTerminate workerTerminate,
            IWorkerCollection workerCollection,
            StopThread stopThead)
            : base(workerTerminate, stopThead)
        {
            Guard.NotNull(() => nameFactory, nameFactory);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => messageProcessing, messageProcessing);
            Guard.NotNull(() => workerTerminate, workerTerminate);
            Guard.NotNull(() => workerCollection, workerCollection);

            _log = log.Create();
            _nameFactory = nameFactory;
            _messageProcessingFactory = messageProcessing;
            _workerCollection = workerCollection;

            IdleStatus = WorkerIdleStatus.Unknown;
        }