Esempio n. 1
0
 protected override void OnStart(string[] args)
 {
     InitializeComponent();
     try
     {
         _log.Info("Start service");
         var workerCount    = Common.Obj2Int(ConfigurationManager.AppSettings["WorkCount"], 1);
         var rabbitMqServer = RabbitMQManager.GetRabbitMQServer("rabbitMQ177");
         _cancelTokenSource = new CancellationTokenSource();
         _workers           = new WorkerChangePriceToHistoryPriceSqlUi[workerCount];
         for (var i = 0; i < workerCount; i++)
         {
             var j = i;
             Task.Factory.StartNew(() =>
             {
                 _log.InfoFormat("Start worker {0}", j);
                 _workers[j] = new WorkerChangePriceToHistoryPriceSqlUi(_cancelTokenSource.Token);
                 _workers[j].Start();
             });
         }
     }
     catch (Exception exx)
     {
         _log.Error(exx);
     }
 }
Esempio n. 2
0
        public void WorkerChangePriceToHistoryPriceSqlUiTest()
        {
            WorkerChangePriceToHistoryPriceSqlUi w = new WorkerChangePriceToHistoryPriceSqlUi(new CancellationToken());

            w.Start();
        }