protected ComponentAccessor( string componentName, IComponentService component, ApplicationConfiguration configuration) { ComponentName = componentName; ComponentType = configuration.GetComponentType(componentName); this.component = component; ConfigurationReduction = new XmlReduction(); }
/// <summary> /// Gets a configuration reduced with given reduction. /// </summary> /// <param name="reduction">a filter to select only parts of the /// configuration</param> /// <returns>reduced configuration</returns> public ApplicationConfiguration GetReducedConfiguration(XmlReduction reduction) { XDocument reducedContent = reduction.GetReducedXml(Content); var result = new ApplicationConfiguration(reducedContent); return result; }
public ApplicationConfiguration GetConfiguration(XmlReduction reduction) { ApplicationConfiguration config = GetConfiguration(); ApplicationConfiguration result = config.GetReducedConfiguration(reduction); return result; }
public Gateway() { ConfigurationReduction = new XmlReduction(); waitingResultMessageHandlers = new ConcurrentDictionary<Guid, ResultHandlingInfo>(); }
public void Start(string componentName, IBrokerServiceForProcessor brokerService) { Name = componentName; BrokerService = brokerService; ConfigReduction = new XmlReduction(); Configuration = BrokerService.GetConfiguration(ConfigReduction); tokensCount = 0; tokensFinishedEvent = new ManualResetEvent(true); tokensToProcess = new BlockingCollection<Token>(new ConcurrentQueue<Token>()); isStopping = false; #region Create and start concurrentProcessors int concurrentThreadsCount = Configuration.GetConcurrentThreadsCountForProcessor(Name); // NOTE: an exception from inicialization should stop the XRouter service CreateMessageFlowInstances(concurrentThreadsCount); concurrentProcessors = new ConcurrentBag<SingleThreadProcessor>(); for (int i = 0; i < concurrentThreadsCount; i++) { // NOTE: it is essential to copy the index variable // to prevent using a closure int processorIndex = i; // NOTE: exceptions there do not stop the XRouter service Task.Factory.StartNew(TraceLog.WrapWithExceptionLogging( delegate{ SingleThreadProcessor processor = new SingleThreadProcessor( tokensToProcess, this, messageFlows[processorIndex]); concurrentProcessors.Add(processor); processor.Run(); }), TaskCreationOptions.LongRunning); } #endregion }