private void RunConsumer(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, bool inMemoryDb, ITaskFactory factory) { var queue = new SimpleConsumerAsync(); queue.RunWithFactory(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, inMemoryDb, factory); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, bool inMemoryDb) { var factory = SimpleConsumerAsync.CreateFactory(workerCount, queueSize, out var schedulerContainer); using (schedulerContainer) { using (factory.Scheduler) { var task1 = Task.Factory.StartNew( () => RunConsumer(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, 1, inMemoryDb, factory)); var task2 = Task.Factory.StartNew( () => RunConsumer(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, 2, inMemoryDb, factory)); var task3 = Task.Factory.StartNew( () => RunConsumer(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, 3, inMemoryDb, factory)); Task.WaitAll(task1, task2, task3); } } }