/// <summary> /// Loads the configuration. /// </summary> /// <param name="xmlNodeConfig">The XML node config.</param> internal virtual void LoadConfiguration(XmlNode xmlNodeConfig) { // Load request manager general settings isEnabled = Convert.ToBoolean(xmlNodeConfig.Attributes["Enabled"].Value); description = xmlNodeConfig.Attributes["Description"].Value; processorType = xmlNodeConfig.Attributes["ProcessorType"].Value; minThreads = Math.Max(Convert.ToInt32(xmlNodeConfig.Attributes["MinThreads"].Value), 1); maxThreads = Math.Max(Convert.ToInt32(xmlNodeConfig.Attributes["MaxThreads"].Value), 1); workPauseSeconds = Math.Min(Convert.ToDecimal(xmlNodeConfig.Attributes["WorkPauseSeconds"].Value), 10); shutdownPauseSeconds = Math.Min(Convert.ToDecimal(xmlNodeConfig.Attributes["ShutdownPauseSeconds"].Value), 10); consumeUnprocessed = Convert.ToBoolean(xmlNodeConfig.Attributes["ConsumeUnprocessed"].Value); maxErrors = Math.Max(Convert.ToInt32(xmlNodeConfig.Attributes["MaxErrors"].Value), 0); // See if we're tracing if (this.RequestController.Trace) { // String builder message StringBuilder logMessage = new StringBuilder(); logMessage.AppendFormat("Loaded Request Manager <b>\"{0}\"</b> configuration.", description); logMessage.AppendFormat("<br>Type: {0}", processorType); logMessage.AppendFormat("<br>Enabled: {0}", isEnabled); logMessage.AppendFormat("<br>Description: {0}", description); logMessage.AppendFormat("<br>Min Threads: {0}", minThreads); logMessage.AppendFormat("<br>Max Threads: {0}", maxThreads); logMessage.AppendFormat("<br>Work Pause Secs: {0}", workPauseSeconds); logMessage.AppendFormat("<br>Shutdown Pause Secs: {0}", shutdownPauseSeconds); logMessage.AppendFormat("<br>Consume Unprocessed: {0}", consumeUnprocessed); logMessage.AppendFormat("<br>Max Errors: {0}", maxErrors); // Log debug information (using HTML file format) Logger.Write(new LogEntry( logMessage.ToString(), "Request Management Trace", 0, 0, TraceEventType.Information, "Request Management Trace", null)); } // If we're enabled load remaining settings if (IsEnabled) { // Load request manager custom settings RequestController.LoadCustomSettings(xmlNodeConfig.SelectSingleNode("CustomSettings"), customSettings); // The constructor for request processors ConstructorInfo requestProcessorConstructor = null; // Use reflection to store the constructor of the class that implements DataProvider Type t = Type.GetType(processorType, true); // Get public instance constructor that takes a RequestManager requestProcessorConstructor = t.GetConstructor(new Type[] { typeof(RequestManager) }); // Create the request processors, one for each thread for (int i = 0; i < maxThreads; i++) { // Create the request processor and pass this request manager RequestProcessor reqProcessor = (RequestProcessor)requestProcessorConstructor.Invoke(new Object[] { this }); // See if we're tracing if (this.RequestController.Trace) { // Log debug information (using HTML file format) Logger.Write(new LogEntry( string.Format("Loading Subscribers for Request Processor <b>#{0}</b> for Request Manager <b>\"{1}\"</b>", i + 1, description), "Request Management Trace", 0, 0, TraceEventType.Information, "Request Management Trace", null)); } // Get the request processor to load its configuration reqProcessor.LoadConfiguration(xmlNodeConfig.SelectSingleNode("Subscribers")); // Add the request processor to our list of processors requestProcessors.Add(reqProcessor); } } }