Example #1
0
        private static void Worker(Object obj)
        {
            SelfParam   sp     = (SelfParam)obj;
            var         self   = sp.Self;
            var         id     = sp.Id;
            CncReader   reader = self.targetHandles[id].Item1;
            KafkaSender sender = self.targetHandles[id].Item2;

            while (isWorking)
            {
                //logger.Info("Task#" + id + " started!");
                string resp = reader.read();
                sender.Send(self.yml["kafka"]["topic"].ToString(), resp);
                //logger.Info("Gen msg - " + resp);
                Thread.Sleep((int)self.yml["acq"]["interval"]);
            }
        }
Example #2
0
 public void Start()
 {
     logger.Info("AcqCnc started!");
     isWorking = true;
     foreach (var id in targetHandles.Keys)
     {
         var param = new SelfParam
         {
             Self = this,
             Id   = id
         };
         targetWorkers[id].Start(param);
     }
     //Thread worker = new Thread(new ParameterizedThreadStart(Worker));
     //var param = new SelfParam
     //{
     //    Self = this,
     //    Id = "10.8.8.231:8193"
     //};
     //worker.Start(param);
     //Worker(this, "10.8.8.231:8193");
 }