Пример #1
0
        /// <summary>
        /// 监控多张SSB表,每个表开启一个线程来处理
        /// </summary>
        /// <param name="jobContext"></param>
        /// <param name="processConfig"></param>
        private static void MultiChannelProcess(JobContext jobContext, SSBProcessConfig processConfig)
        {
            List <string> logs = new List <string>();

            using (ThreadWaitHandle handler = new ThreadWaitHandle(processConfig.SSBChannels.Count))
            {
                for (int i = 0; i < processConfig.SSBChannels.Count; i++)
                {
                    SSBChannel channel = processConfig.SSBChannels[i];
                    ThreadPool.QueueUserWorkItem((object obj) =>
                    {
                        try
                        {
                            SSBProcessBase processer = SSBProcessFactory.Create(channel);
                            processer.RunProcess();

                            lock (logs)
                            {
                                logs.AddRange(processer.Logs);
                            }
                        }
                        finally
                        {
                            handler.ReleaseOne();
                        }
                    });
                }
            }

            OutPutLog(logs, jobContext);
        }
Пример #2
0
        public static SSBProcessBase Create(SSBChannel ssbChannel)
        {
            switch (ssbChannel.Version)
            {
            case SSBVersion.V1:
                return(new SSBProcessV1(ssbChannel));

            case SSBVersion.V2:
                return(new SSBProcessV2(ssbChannel));

            case SSBVersion.V3:
                return(new SSBProcessV3(ssbChannel));

            case SSBVersion.Customer:
                return(new SSBProcessCustomer(ssbChannel));

            default:
                return(new SSBProcessV2(ssbChannel));
            }
        }
Пример #3
0
 public SSBProcessV3(SSBChannel ssbChannel)
     : base(ssbChannel)
 {
 }
Пример #4
0
 public SSBProcessBase(SSBChannel ssbChannel)
 {
     _ssbChannel = ssbChannel;
     _maxRecord  = Convert.ToInt32(ConfigHelper.GetAppSettings(MaxRecourd));
 }
Пример #5
0
 public SSBProcessCustomer(SSBChannel ssbChannel)
     : base(ssbChannel)
 {
 }