public void Start() { if (subscriberCollection.Subscribers.Any() == false) { log.Warn($"Consumer {boundedContext}.{typeof(T).Name} not started because there are no subscribers"); return; } ConsumerStart(); pools.Clear(); var poolName = $"cronus: {typeof(T).Name}"; WorkPool pool = new WorkPool(poolName, numberOfWorkers); for (int i = 0; i < numberOfWorkers; i++) { var consumer = new RabbitMqContinuousConsumer <T>(boundedContext, serializer, connectionFactory, subscriberCollection); pool.AddWork(consumer); } pools.Add(pool); pool.StartCrawlers(); ConsumerStarted(); }
public void Start(int?numberOfWorkers = null) { int workers = numberOfWorkers.HasValue ? numberOfWorkers.Value : NumberOfWorkers; pools.Clear(); foreach (var endpointDefinition in transport.EndpointFactory.GetEndpointDefinition(this, subscriptions)) { 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(subscriptions, endpoint, serializer, messageThreshold)); } pools.Add(pool); pool.StartCrawlers(); } }
public void Start(int?numberOfWorkers = null) { ConsumerStart(); int workers = numberOfWorkers.HasValue ? numberOfWorkers.Value : NumberOfWorkers; pools.Clear(); foreach (var factory in transport.GetAvailableConsumers(serializer, subscriptions, Name)) { var poolName = string.Format("cronus: " + Name); WorkPool pool = new WorkPool(poolName, workers); for (int i = 0; i < workers; i++) { pool.AddWork(factory.CreateConsumer()); } pools.Add(pool); pool.StartCrawlers(); } ConsumerStarted(); }