}// public void StartProcessing() /// <summary> /// ProcessJobControlFileThread:Method that blocks on the file Q waiting for a file /// to be queued up that needs to be processed. /// The file that is processed is the MSC CDRs, it is parsed and a list of CDRs is /// returned. The CDR list is then iterated through to create CIBER records. /// </summary> private void ProcessJobControlFileThread() { List<OmcCdr> theCdrs; string fileName = String.Empty; try { while (true) { try { // Create a reference to the current directory. DirectoryInfo dir = new DirectoryInfo( m_ciberDirectory ); // Create an array representing the files in the current directory. FileInfo[] fi = dir.GetFiles(); // add code here to verify that the file has not already been downloaded // all downloaded files will get processed into the database // if (theFileToGrab) is not in db // download the file foreach (FileInfo fName in fi) { // method to parse the CDRs string parsedFileName = ParseFileName(fName.FullName); theCdrs = this.ProcessOmcCdrFile(fName.FullName); // uses the sidbid mgr to maintain running totals m_ciberCreator.ProcessCallRecords(theCdrs); // get a new file name for the syniverse batch file int fileNum = m_ciberDb.GetFileNumber(); string ciberFileName = m_ciberOutputFileName + "." + fileNum.ToString("D3"); // uses the sidbid mgr to create header/r22/trailer records m_ciberCreator.CreateCiberRecordsNew(ciberFileName); // create header/cdrs/trailer for the Broadworks CDR file for billing // the list of CDRs was created previously in the processCallRecords method // and stored in the CdrMgr object to be written here, the list is then cleared if (CreateCdrFile(parsedFileName)) { // ciber records processed and file created // update the filenumber for the next iteration m_ciberDb.UpdateFileNumber(); } // housekeeping, update our database that we have processed this file UpdateFileInfo(parsedFileName); // move the file with the full path name this.MoveTheFile(fName.FullName); } // for each }//try catch (System.Threading.ThreadAbortException) { EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():Service is stopping", EventLogEntryType.Information, 2001); return; } catch (System.Exception ex) {// generic exception EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():ECaught:" + ex.ToString(), EventLogEntryType.Error, 3000); } // wait for the next interval System.Threading.Thread.Sleep(m_ProcessThreadIntervalInMSecs); }// while(true) } catch (System.Threading.ThreadAbortException) { EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():ECaught: thread is shutting down", EventLogEntryType.Information, 2001); } catch (System.Exception ex) { EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():ECaught:" + ex.ToString(), EventLogEntryType.Error, 3000); }// catch finally { // clean up }// finally }// private void ProcessJobControlFile()
}// public void StartProcessing() /// <summary> /// ProcessJobControlFileThread:Method that blocks on the file Q waiting for a file /// to be queued up that needs to be processed. /// The file that is processed is the MSC CDRs, it is parsed and a list of CDRs is /// returned. The CDR list is then iterated through to create CIBER records. /// </summary> private void ProcessJobControlFileThread() { List<OmcCdr> theCdrs; string fileName = String.Empty; string fName = String.Empty; try { while (true) { fName = String.Empty; try { if (m_fileNameQ.Count > 0) { // lock the root lock (m_fileNameQ.SyncRoot) { // dequeue the next filename to process fName = (string)m_fileNameQ.Dequeue(); }//lock(m_fileNameQ.SyncRoot) } //create the command string if (fName != String.Empty) { // method to parse the CDRs string parsedFileName = ParseFileName(fName); theCdrs = this.ProcessOmcCdrFile(fName); // uses the sidbid mgr to maintain running totals m_ciberCreator.ProcessCallRecords(theCdrs); // get a new file name for the syniverse batch file int fileNum = m_ciberDb.GetFileNumber(); string ciberFileName = m_ciberOutputFileName + "." + fileNum.ToString("D3"); // uses the sidbid mgr to create header/r22/trailer records m_ciberCreator.CreateCiberRecordsNew( ciberFileName ); // create header/cdrs/trailer for the Broadworks CDR file for billing // the list of CDRs was created previously in the processCallRecords method // and stored in the CdrMgr object to be written here, the list is then cleared if (CreateCdrFile(parsedFileName)) { // ciber records processed and file created // update the filenumber for the next iteration m_ciberDb.UpdateFileNumber(); } // housekeeping, update our database that we have processed this file UpdateFileInfo(parsedFileName); // move the file with the full path name this.MoveTheFile(fName); } }//try catch (System.Threading.ThreadAbortException) { EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():Service is stopping", EventLogEntryType.Information, 2001); return; } catch (System.Exception ex) {// generic exception EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():ECaught:" + ex.ToString(), EventLogEntryType.Error, 3000); } // wait for the next interval System.Threading.Thread.Sleep(m_ProcessThreadIntervalInMSecs); }// while(true) } catch (System.Threading.ThreadAbortException) { EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():ECaught: thread is shutting down", EventLogEntryType.Information, 2001); } catch (System.Exception ex) { EventLog.WriteEntry(m_eventLogName, "OmcCiberHandler::ProcessJobControlFile():ECaught:" + ex.ToString(), EventLogEntryType.Error, 3000); }// catch finally { // clean up }// finally }// private void ProcessJobControlFile()