コード例 #1
0
        protected override RESULT Process(StringBuilder messager)
        {
            var working = Config.Instance.INFO.BizTime.IsWorkingTime;

            if (working > 0)
            {
                if (CheckTable <DBTStkFavoriteEntity>())
                {
                    accessor.RetrieveEntity <DBTStkFavoriteEntity>().FindAll(data => !workers.Any(worker => worker.id.Equals(data.Code))).ForEach(entity =>
                    {
                        var StockTask = new StockClient(entity.Code, null);

                        var pipe1 = new DataPipe();
                        var pipe2 = new DataPipe();
                        AddPuts[SocketClient.ID](StockTask.id, pipe1);
                        StockTask.AddGetPlug(SocketClient.ID, pipe1);
                        AddGets[SocketClient.ID](StockTask.id, pipe2);
                        StockTask.AddPutPlug(SocketClient.ID, pipe2);

                        var pipe3 = new DataPipe();
                        var pipe4 = new DataPipe();
                        StockTask.AddPutPlug(TradeClient.ID, pipe3);
                        AddGets[TradeClient.ID](StockTask.id, pipe3);
                        StockTask.AddGetPlug(TradeClient.ID, pipe4);
                        AddPuts[TradeClient.ID](StockTask.id, pipe4);

                        var pipe5 = new DataPipe();
                        var pipe6 = new DataPipe();
                        AddPuts[CollectClient.ID](StockTask.id, pipe5);
                        StockTask.AddGetPlug(CollectClient.ID, pipe5);
                        AddGets[CollectClient.ID](StockTask.id, pipe6);
                        StockTask.AddPutPlug(CollectClient.ID, pipe6);

                        var worker = new Worker(StockTask.id, StockTask);
                        workers.Add(worker);
                        worker.Start();
                    });
                }
            }
            else
            {
                tables.Clear();
            }

            return(RESULT.OK);
        }
コード例 #2
0
 public void AddPutPlugAction(string id, Action <string, DataPipe> action)
 {
     if (string.IsNullOrWhiteSpace(id) || action == null)
     {
         return;
     }
     if (AddPuts.ContainsKey(id))
     {
         return;
     }
     AddPuts.Add(id, action);
 }