Ejemplo n.º 1
0
        public void RunProcess()
        {
            List <string> messageList = CommonDA.GetMessageSuccess(_maxRecord, _ssbChannel.DataCommand);

            if (messageList.Count == 0)
            {
                this.WriteLog(string.Format("[{0}]没有要处理的消息", _ssbChannel.Name));
                return;
            }

            this.WriteLog(string.Format("========[{0}] Start========", _ssbChannel.Name));

            foreach (var item in messageList)
            {
                this.ProcessMessage(item);
            }

            #region 异步暂时无法解决按顺序调用服务的问题
            //List<List<string>> groups = SplitMessagesToGroup(messageList, 10);
            //foreach (List<string> group in groups)
            //{
            //    using (ThreadWaitHandle handler = new ThreadWaitHandle(group.Count))
            //    {
            //        foreach (string item in group)
            //        {
            //            string ssbMsg = item;
            //            ThreadPool.QueueUserWorkItem((object obj) =>
            //            {
            //                this.ProcessMessage(handler, ssbMsg);
            //            });
            //        }
            //    }
            //}
            #endregion

            this.WriteLog(string.Format("========[{0}] End========", _ssbChannel.Name));
        }