public CommandMetricObserver(AtlasConfig config)
        {
            string poolName = "atlas-" + config.Endpoint;
            int numberOfThreadsAvailableForThePool = 1;

            pool = new WorkPool(poolName, numberOfThreadsAvailableForThePool);
            for (int i = 0; i < numberOfThreadsAvailableForThePool; i++)
            {
                pool.AddWork(new MetricPublishTask(config));
            }
        }
Esempio n. 2
0
        public void Start(int? numberOfWorkers = null)
        {
            int workers = numberOfWorkers.HasValue
                ? numberOfWorkers.Value
                : NumberOfWorkers;

            pools.Clear();
            foreach (var endpointDefinition in transport.EndpointFactory.GetEndpointDefinition(messageProcessor))
            {
                var poolName = String.Format("Workpool {0}", endpointDefinition.EndpointName);
                WorkPool pool = new WorkPool(poolName, workers);
                for (int i = 0; i < workers; i++)
                {
                    IEndpoint endpoint = transport.EndpointFactory.CreateEndpoint(endpointDefinition);
                    pool.AddWork(new PipelineConsumerWork(messageProcessor, endpoint, serializer, messageThreshold, circuitBreakerFactory.Create(transport, serializer, endpointDefinition)));
                }
                pools.Add(pool);
                pool.StartCrawlers();
            }
        }