public void StartProcessing() { this.CreateEventLog(); m_dbMgr= new AMSDbMgr(); m_rdr = new AMSFileReader(); // the the path where to move processed files m_filemovePath = ConfigurationManager.AppSettings["ProcessedFileFolder"]; string watchFolder = System.String.Empty; // get the time to sleep between failed file open operations m_ProcessThreadIntervalInMSecs = 1000 * Convert.ToInt32(ConfigurationManager.AppSettings["ProcessThreadIntervalInSecs"]); try { // create the Watcher for file type in the watchfolder; config params watchFolder = ConfigurationManager.AppSettings["WatchFolder"]; string fileType = ConfigurationManager.AppSettings["WatchFileType"]; FileSystemWatcher WatchFile = new FileSystemWatcher(watchFolder, fileType); // Watch for changes in LastAccess and LastWrite times WatchFile.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastAccess | NotifyFilters.LastWrite; WatchFile.Created += new FileSystemEventHandler(this.ProcessFileWatcher); // added this on 11/02 WatchFile.Changed += new FileSystemEventHandler(this.ProcessFileWatcher); WatchFile.EnableRaisingEvents = true; //EventLog.WriteEntry(m_eventLogName, "Watching Folder>" + watchFolder, EventLogEntryType.Information, 2002); // configure the file name FIFO queue Queue aQ = new Queue(100); // synchronize the queue m_fileNameQ = Queue.Synchronized(aQ); // launch the job control processing thread monitoring the queue m_procThread = new Thread(new ThreadStart(ProcessJobControlFileThread)); m_logger.WriteToLogFile("-NFORMATIONAL::AMSHandler::StartProcessing():StartingThreadToProcessMAFFIles"); m_procThread.Start(); m_logger.WriteToLogFile("-NFORMATIONAL::AMSHandler::StartProcessing():StartedThreadToProcessMAFFIles"); } catch (Exception ex) { m_logger.WriteToLogFile("-NEXCEPTIONCAUGHT::AMSHandler::StartProcessing():ExceptionCaught:" + ex.Message + ex.StackTrace ); } }
public void StartProcessing() { this.CreateEventLog(); m_dbMgr = new AMSDbMgr(); m_rdr = new AMSFileReader(); // the the path where to move processed files m_filemovePath = ConfigurationManager.AppSettings["ProcessedFileFolder"]; string watchFolder = System.String.Empty; // get the time to sleep between failed file open operations m_ProcessThreadIntervalInMSecs = 1000 * Convert.ToInt32(ConfigurationManager.AppSettings["ProcessThreadIntervalInSecs"]); try { // create the Watcher for file type in the watchfolder; config params watchFolder = ConfigurationManager.AppSettings["WatchFolder"]; string fileType = ConfigurationManager.AppSettings["WatchFileType"]; FileSystemWatcher WatchFile = new FileSystemWatcher(watchFolder, fileType); // Watch for changes in LastAccess and LastWrite times WatchFile.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastAccess | NotifyFilters.LastWrite; WatchFile.Created += new FileSystemEventHandler(this.ProcessFileWatcher); // added this on 11/02 WatchFile.Changed += new FileSystemEventHandler(this.ProcessFileWatcher); WatchFile.EnableRaisingEvents = true; //EventLog.WriteEntry(m_eventLogName, "Watching Folder>" + watchFolder, EventLogEntryType.Information, 2002); // configure the file name FIFO queue Queue aQ = new Queue(100); // synchronize the queue m_fileNameQ = Queue.Synchronized(aQ); // launch the job control processing thread monitoring the queue m_procThread = new Thread(new ThreadStart(ProcessJobControlFileThread)); m_logger.WriteToLogFile("-NFORMATIONAL::AMSHandler::StartProcessing():StartingThreadToProcessMAFFIles"); m_procThread.Start(); m_logger.WriteToLogFile("-NFORMATIONAL::AMSHandler::StartProcessing():StartedThreadToProcessMAFFIles"); } catch (Exception ex) { m_logger.WriteToLogFile("-NEXCEPTIONCAUGHT::AMSHandler::StartProcessing():ExceptionCaught:" + ex.Message + ex.StackTrace); } }// public void StartProcessing()