/// <summary> /// To span the threads to start the data upload process based on the configuration settings /// </summary> private void StartSimultaneousUploadProcess() { Logger.Log.Info("Inside Methosd"); int threadCount = 0; DataUploadServiceSettings uploadSettings = ConfigurationManager.GetSection("DataUploadServiceSettings") as DataUploadServiceSettings; foreach (DataReaderSetting readerSetting in uploadSettings.DataReaderSettings) { if (readerSetting.IsActive) { threadCount++; DataReader dataReader = new DataReader(); ParameterizedThreadStart paramThread = new ParameterizedThreadStart(dataReader.StartUpload); Thread threadInstance = new Thread(paramThread); threadInstance.Name = readerSetting.Name; threadInstance.Start(readerSetting); Interlocked.Increment(ref StaticInfo.ThreadCount); } } Logger.Log.InfoFormat("Total No of Thread Started for Data Recovery : {0}", threadCount); }
/// <summary> /// To validate the DataReaderSettings /// </summary> /// <returns>returns true if it has valid information in DataReaderSettings</returns> private static bool HasValidDataReaderSettings() { Logger.Log.Info("Inside Method"); DataUploadServiceSettings serviceSettings = ConfigurationManager.GetSection("DataUploadServiceSettings") as DataUploadServiceSettings; if (serviceSettings == null) { Logger.Log.Error("DataUploadServiceSettings missing in congfiguration file"); return(false); } if (serviceSettings.DataReaderSettings.Count == 0) { Logger.Log.Error("There is no DataReaderSetting configured in congfiguration file"); return(false); } if (serviceSettings.DataReaderSettings.OfType <DataReaderSetting>().Where(R => R.IsActive).Count() == 0) { Logger.Log.Error("There is no active DataReaderSetting configured in congfiguration file"); return(false); } foreach (DataReaderSetting setting in serviceSettings.DataReaderSettings) { if (string.IsNullOrEmpty(setting.RecoveryFolder)) { Logger.Log.Error("Recovery folder missing in congfiguration"); return(false); } if (!TryCreateFolderPath(setting.RecoveryFolder)) { Logger.Log.Error("Recovery folder cannot be created / wrongly configured"); return(false); } if (string.IsNullOrEmpty(setting.InvalidDBRequestFolder)) { Logger.Log.Error("Invalid DB Request folder missing in congfiguration"); return(false); } if (!TryCreateFolderPath(setting.InvalidDBRequestFolder)) { Logger.Log.Error("Invalid DB Request folder cannot be created / wrongly configured"); return(false); } if (string.IsNullOrEmpty(setting.InvalidXmlFolder)) { Logger.Log.Error("Invalid Xml folder missing in congfiguration"); return(false); } if (!TryCreateFolderPath(setting.InvalidXmlFolder)) { Logger.Log.Error("Invalid Xml folder cannot be created / wrongly configured"); return(false); } if (string.IsNullOrEmpty(setting.ConnectionStringName)) { Logger.Log.Error("Connectin string name missing in congfiguration"); return(false); } if (!TryGettingConnectionStringSetting(setting.ConnectionStringName)) { Logger.Log.Error("Connectin string name is not available in connectionStrings section"); return(false); } if (string.IsNullOrEmpty(setting.LoggerName)) { Logger.Log.Error("Logger name missing in congfiguration"); return(false); } if (string.IsNullOrEmpty(setting.QueueName)) { Logger.Log.Error("Queue name missing in congfiguration"); return(false); } } return(true); }