public void Start() { if (haveStarted) { return; } internalStart(); queue = _sqlQueueManager.GetQueue(queueName); Task.Factory.StartNew(() => { cleanUp = new CleanAction(queue); timeout = new TimeoutAction(queue); logger.DebugFormat("Starting {0} threads to handle messages on {1}, number of retries: {2}", threadCount, queueEndpoint, numberOfRetries); for (var i = 0; i < threadCount; i++) { threads[i] = new Thread(ReceiveMessage) { Name = "Rhino Service Bus Worker Thread #" + i, IsBackground = true }; threads[i].Start(i); } }).ContinueWith(_ => internalPostStart(), TaskContinuationOptions.OnlyOnRanToCompletion); }
public void Start() { if (haveStarted) return; internalStart(); queue = _sqlQueueManager.GetQueue(queueName); Task.Factory.StartNew(() => { cleanUp = new CleanAction(queue); timeout = new TimeoutAction(queue); logger.DebugFormat("Starting {0} threads to handle messages on {1}, number of retries: {2}", threadCount, queueEndpoint, numberOfRetries); for (var i = 0; i < threadCount; i++) { threads[i] = new Thread(ReceiveMessage) { Name = "Rhino Service Bus Worker Thread #" + i, IsBackground = true }; threads[i].Start(i); } }).ContinueWith(_ => internalPostStart(), TaskContinuationOptions.OnlyOnRanToCompletion); }