public static CreateFactory ( int maxThreads, int maxQueueSize, SchedulerContainer &schedulerCreator ) : ITaskFactory | ||
maxThreads | int | |
maxQueueSize | int | |
schedulerCreator | SchedulerContainer | |
리턴 | ITaskFactory |
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, ConnectionInfoTypes type) { 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, // ReSharper disable once AccessToDisposedClosure queueSize, 1, factory, type)); var task2 = Task.Factory.StartNew( () => RunConsumer(messageCount, runtime, timeOut, workerCount, readerCount, // ReSharper disable once AccessToDisposedClosure queueSize, 2, factory, type)); var task3 = Task.Factory.StartNew( () => RunConsumer(messageCount, runtime, timeOut, workerCount, readerCount, // ReSharper disable once AccessToDisposedClosure queueSize, 3, factory, type)); Task.WaitAll(task1, task2, task3); } } }