コード例 #1
0
        /// <summary>
        ///ReactiveQueue
        /// </summary>
        /// <param name="item"></param>
        void rqueue_DequeueHandler(List <FileArgs> items)
        {
            try
            {
                //用于处理重复消息 (当更新文件内容时,会产生多个消息)
                var knownKeys = new HashSet <string>();
                //依次处理消息
                foreach (var item in items)
                {
                    //判断消息是否有价值
                    if (!FileListenHelper.IsMessageValuable(item.FileSystemEventArgs))
                    {
                        continue;
                    }

                    if (knownKeys.Add(item.FileSystemEventArgs.Name))
                    {
                        ltm.Handle(item.MonitorServer, item.FileSystemEventArgs);
                        mtm.Handle(item.MonitorServer, item.FileSystemEventArgs);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(MessageUtil.GetExceptionMsg(ex, ""));
            }
        }
コード例 #2
0
 /// <summary>
 /// 同步
 /// </summary>
 private void Synchronise(List <FileArgs> items)
 {
     try
     {
         //依次处理消息
         foreach (var item in items)
         {
             ltm.Handle(item.MonitorServer, item.FileSystemEventArgs);
             mtm.Handle(item.MonitorServer, item.FileSystemEventArgs);
         }
     }
     catch (Exception ex)
     {
         Common.LogManager.WriteLog(Common.LogFile.Error, MessageUtil.GetExceptionMsg(ex, ""));
     }
 }
コード例 #3
0
 /// <summary>
 ///ReactiveQueue
 /// </summary>
 /// <param name="item"></param>
 void rqueue_DequeueHandler(List <FileArgs> items)
 {
     try
     {
         //用于处理重复消息 (当更新文件内容时,会产生多个消息)
         var knownKeys = new HashSet <string>();
         //依次处理消息
         foreach (var item in items)
         {
             if (knownKeys.Add(item.FileSystemEventArgs.FullPath))
             {
                 ltm.Handle(item.MonitorServer, item.FileSystemEventArgs);
                 mtm.Handle(item.MonitorServer, item.FileSystemEventArgs);
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error(MessageUtil.GetExceptionMsg(ex, ""));
     }
 }