Example #1
0
        protected override void OnStop()
        {
            _stoping = true;
            try
            {
                log.Debug("OnStop");

                if (_timerProcess != null && _spProcess != null)
                {
                    _spProcess.StopDoWork();
                }

                if (_timerProcess != null && _spProcess != null)
                {
                    if (_evProcess != null)
                    {
                        _evProcess.WaitOne();
                    }
                    _timerProcess.Enabled = false;
                    _timerProcess         = null;

                    _spProcess.OnStop();
                    _spProcess = null;
                }
            }
            catch (Exception ex)
            {
                log.Error("!!!Error", ex);
            }
        }
Example #2
0
 public PollingWorker(IServiceProcess serviceProcess, IPollingConfiguration configuration, string name)
     : base(serviceProcess, configuration, name)
 {
     _random       = new Random();
     _pollTimer    = new Timer(Run);
     _cancellation = new CancellationTokenSource();
 }
Example #3
0
        protected ServiceWorkerBase(IServiceProcess serviceProcess, TConfiguration configuration, string name)
        {
            Name = name;

            _serviceProcess = serviceProcess;
            _configuration  = configuration;
        }
        public void Test1()
        {
            IServiceProcess serviceProcess = Container.Resolve <IServiceProcess>();

            var result = serviceProcess.Process(new Request("test1", "test2", "test3"));

            Assert.IsType <Response>(result);
        }
Example #5
0
        public static ServiceProcessDto MapServiceProcessToDto(IServiceProcess src)
        {
            if (src == null)
            {
                return(null);
            }

            return(new ServiceProcessDto
            {
                Id = src.Id,
                Description = src.Description,
                ServiceId = src.ServiceId,
                Name = src.Name,
                Owner = src.Owner,
                Improvements = src.Improvements,
                Benefits = src.Benefits
            });
        }
Example #6
0
        /// <summary>
        /// Init and run all working proccesses
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            log.Debug("OnStart");

            try
            {
                _spProcess = new ServiceProcess();
                _spProcess.OnInit();

                _timerProcess           = new System.Timers.Timer();
                _timerProcess.Elapsed  += TimerProcess_Elapsed;
                _timerProcess.Interval  = 10; //do not wait first time
                _timerProcess.AutoReset = false;
                _firstTickProcess       = true;
                _timerProcess.Enabled   = true;
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw;
            }
        }
 public ConsumerWorker(IServiceProcess serviceProcess, IConsumerConfiguration configuration, string name)
     : base(serviceProcess, configuration, name)
 {
 }
Example #8
0
 public ServicesController(IServiceProcess serviceProces)
 {
     _serviceProcess = serviceProces;
 }