/// <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); }
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)); } }
public SSBProcessV3(SSBChannel ssbChannel) : base(ssbChannel) { }
public SSBProcessBase(SSBChannel ssbChannel) { _ssbChannel = ssbChannel; _maxRecord = Convert.ToInt32(ConfigHelper.GetAppSettings(MaxRecourd)); }
public SSBProcessCustomer(SSBChannel ssbChannel) : base(ssbChannel) { }