public void RunMultiple( int producerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueContainer = new QueueContainer <RedisQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); tests.RunTestMultipleProducers <RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, true, producerCount, queueContainer.CreateTimeSync(connectionString), LoggerShared.Create(queueName, GetType().Name)); } finally { using (var queueCreator = new QueueCreationContainer <RedisQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } } }
public async void Run( int messageCount, bool interceptors, bool batchSending, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerAsyncShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { await producer.RunTestAsync <RedisQueueInit, FakeMessage>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, null).ConfigureAwait(false); } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
#pragma warning disable xUnit1013 // Public method should be marked as test public void RunWithFactory(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, #pragma warning restore xUnit1013 // Public method should be marked as test int messageType, ITaskFactory factory, ConnectionInfoTypes type) { Factory = factory; Run(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, type); }
public void RunMultiple( bool interceptors, int producerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueContainer = new QueueContainer<RedisQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); tests.RunTestMultipleProducers<RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, interceptors, producerCount, queueContainer.CreateTimeSync(connectionString)); } finally { using (var queueCreator = new QueueCreationContainer<RedisQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } } }
public async void Run( int messageCount, bool interceptors, bool batchSending, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerAsyncShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { await producer.RunTest<RedisQueueInit, FakeMessage>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending); } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
private void RunConsumer(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ITaskFactory factory, ConnectionInfoTypes type) { var queue = new SimpleConsumerAsync(); queue.RunWithFactory(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, factory, type); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, ConnectionInfoTypes type) { SchedulerContainer schedulerContainer; var factory = SimpleConsumerAsync.CreateFactory(workerCount, queueSize, out 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); } } }
public void Run(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { //create data var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpDynamic, 0); } //process data var consumer = new ConsumerMethodPoisonMessageShared(); consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, workerCount, logProvider, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); ValidateErrorCounts(queueName, connectionString, messageCount); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, true, 2); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run( int messageCount, bool interceptors, bool batchSending, bool enableDelay, bool enableExpiration, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { if (enableExpiration && enableDelay) { producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, null); } else if (enableDelay) { producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, null); } else if (enableExpiration) { producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, null); } else { producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, null); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, bool route) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { //create data if (route) { var producer = new ProducerShared(); producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateRouteData, Helpers.Verify, false, null, false); } else { var producer = new ProducerShared(); producer.RunTest <RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null, false); } //process data var defaultRoute = route ? Helpers.DefaultRoute : null; var consumer = new ConsumerPoisonMessageShared <FakeMessage>(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, workerCount, logProvider, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)", defaultRoute, false); ValidateErrorCounts(queueName, connectionString, messageCount); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, true, 2); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { //create data var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpCompiled, 0, null, false); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateNoOpDynamic, 0, null, false); } #endif //process data var consumer = new ConsumerMethodPoisonMessageShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, workerCount, logProvider, timeOut, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)", false); ValidateErrorCounts(queueName, connectionString, messageCount); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, true, 2); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, false, id, GenerateMethod.CreateCompiled, runtime, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, false, id, GenerateMethod.CreateDynamic, runtime, null); } #endif Thread.Sleep(2000); var consumer = new ConsumerMethodExpiredMessageShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%10)", id); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.Consumer.Implementation.ConsumerCancelWork(); consumer.Run <RedisQueueInit, FakeMessage, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, runtime, timeOut, workerCount, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount); }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCancelCompiled, runtime); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateCancelDynamic, runtime); } var consumer = new ConsumerMethodHeartBeatShared(); consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } GenerateMethod.ClearCancel(id); } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void RunMultiple( int producerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.JobScheduler.Implementation.JobSchedulerMultipleTests(); consumer.Run <RedisQueueInit, RedisJobQueueCreation, RedisQueueCreation>( new QueueConnection(queueName, connectionString), producerCount); }
public void Run( bool dynamic, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.JobScheduler.Implementation.JobSchedulerTests(); consumer.Run <RedisQueueInit, RedisJobQueueCreation, RedisQueueCreation>( new QueueConnection(queueName, connectionString), false, dynamic, Helpers.Verify, Helpers.SetError); }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, ConnectionInfoTypes type, bool route) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerAsync.Implementation.ConsumerAsyncPoisonMessage(); consumer.Run <RedisQueueInit, FakeMessage, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, timeOut, workerCount, readerCount, queueSize, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount, ValidateErrorCounts); }
public async Task Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerAsync.Implementation.SimpleConsumerAsync(); await consumer.Run <RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount).ConfigureAwait(false); }
public void Run(int messageCount, int timeOut, int workerCount, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethod.Implementation.ConsumerMethodErrorTable(); consumer.Run <RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, timeOut, workerCount, linqMethodTypes, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount, ValidateErrorCounts); }
public async Task Run( int messageCount, bool interceptors, bool batchSending, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var producer = new DotNetWorkQueue.IntegrationTests.Shared.Producer.Implementation.SimpleProducerAsync(); await producer.Run <RedisQueueInit, FakeMessage, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, interceptors, false, batchSending, x => { }, Helpers.GenerateData, Helpers.Verify).ConfigureAwait(false); }
public void Run(int messageCount, int runtime, int timeOut, int readerCount, int routeCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var routeTest = new RouteTestsShared(); routeTest.RunTest<RedisQueueInit, FakeMessageA>(queueName, connectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, GenerateRoutes(routeCount), runtime, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int readerCount, int routeCount, ConnectionInfoTypes type, bool batch) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { var result = oCreation.CreateQueue(); Assert.True(result.Success, result.ErrorMessage); var routeTest = new RouteTestsShared(); routeTest.RunTest <RedisQueueInit, FakeMessageA>(queueName, connectionString, true, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batch, GenerateRoutes(routeCount), runtime, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), oCreation.Scope, "second(*%3)", false); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int timeOut, int workerCount, int readerCount, int queueSize, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { //create data var producer = new ProducerShared(); producer.RunTest<RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false); //process data var consumer = new ConsumerAsyncErrorShared<FakeMessage>(); consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, messageCount, workerCount, timeOut, queueSize, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); ValidateErrorCounts(queueName, messageCount, connectionString); using ( var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(messageCount, false, 2); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run( bool interceptors, bool dynamic, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueContainer = new QueueContainer<RedisQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); if (!dynamic) { tests.RunEnqueueTestCompiled<RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, interceptors, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString)); } else { tests.RunEnqueueTestDynamic<RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, interceptors, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString)); } } finally { using (var queueCreator = new QueueCreationContainer<RedisQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run( bool dynamic, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueContainer = new QueueContainer <RedisQueueInit>(x => { })) { try { var tests = new JobSchedulerTestsShared(); if (!dynamic) { tests.RunEnqueueTestCompiled <RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, true, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString), null, LoggerShared.Create(queueName, GetType().Name)); } #if NETFULL else { tests.RunEnqueueTestDynamic <RedisQueueInit, RedisJobQueueCreation>(queueName, connectionString, true, Helpers.Verify, Helpers.SetError, queueContainer.CreateTimeSync(connectionString), null, LoggerShared.Create(queueName, GetType().Name)); } #endif } finally { using (var queueCreator = new QueueCreationContainer <RedisQueueInit>()) { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var producer = new ProducerShared(); producer.RunTest<RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, false); Thread.Sleep(2000); var consumer = new ConsumerExpiredMessageShared<FakeMessage>(); consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, ConnectionInfoTypes type) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var producer = new ProducerMethodMultipleDynamicShared(); producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateMultipleDynamic, runtime, null); var consumer = new ConsumerMethodShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, workerCount, timeOut, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)"); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool async, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueNameSend = GenerateQueueName.Create(); var logProviderSend = LoggerShared.Create(queueNameSend, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreatorSend = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderSend, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var rpc = new RpcMethodShared <RedisQueueInit, RedisQueueRpcConnection>(); rpc.Run(queueNameSend, queueNameSend, connectionString, connectionString, logProviderSend, logProviderSend, runtime, messageCount, workerCount, timeOut, async, new RedisQueueRpcConnection(connectionString, queueNameSend), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, linqMethodTypes, "second(*%3)"); using (var count = new VerifyQueueRecordCount(queueNameSend, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreatorSend.GetQueueCreation <RedisQueueCreation>(queueNameSend, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, bool async, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueNameSend = GenerateQueueName.Create(); var logProviderSend = LoggerShared.Create(queueNameSend, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreatorSend = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProviderSend, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); var rpc = new RpcMethodShared <RedisQueueInit, FakeResponse, RedisQueueRpcConnection>(); rpc.Run(queueNameSend, queueNameSend, connectionString, connectionString, logProviderSend, logProviderSend, runtime, messageCount, workerCount, timeOut, async, new RedisQueueRpcConnection(connectionString, queueNameSend), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, linqMethodTypes); using (var count = new VerifyQueueRecordCount(queueNameSend, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreatorSend.GetQueueCreation<RedisQueueCreation>(queueNameSend, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run( int messageCount, bool interceptors, bool batchSending, bool enableDelay, bool enableExpiration, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ProducerMethod.Implementation.SimpleMethodProducer(); if (enableExpiration && enableDelay) { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateDelayExpiredData, Verify); } else if (enableDelay) { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateDelayData, Verify); } else if (enableExpiration) { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateExpiredData, Verify); } else { consumer.Run<RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, linqMethodTypes, interceptors, false, batchSending, creation => { }, Helpers.GenerateData, Verify); } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { if (Factory == null) { Factory = CreateFactory(workerCount, queueSize); } var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); if (messageType == 1) { var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, null, false).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)", false); } else if (messageType == 2) { var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, null, false).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)", false); } else if (messageType == 3) { var producer = new ProducerMethodAsyncShared(); producer.RunTestAsync <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, runtime, id, linqMethodTypes, null, false).Wait(timeOut); var consumer = new ConsumerMethodAsyncShared { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)", false); } using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type) { SchedulerContainer schedulerContainer = null; if (Factory == null) { Factory = CreateFactory(workerCount, queueSize, out schedulerContainer); } var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { if (messageType == 1) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared <FakeMessage> { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } else if (messageType == 2) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <RedisQueueInit, FakeMessageA>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared <FakeMessageA> { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } else if (messageType == 3) { var producer = new ProducerAsyncShared(); producer.RunTestAsync <RedisQueueInit, FakeMessageB>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, null).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared <FakeMessageB> { Factory = Factory }; consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), "second(*%3)"); } using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { schedulerContainer?.Dispose(); using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var connectionString = new ConnectionInfo(type).ConnectionString; var consumer = new DotNetWorkQueue.IntegrationTests.Shared.ConsumerMethodAsync.Implementation. ConsumerMethodAsyncRollBack(); consumer.Run <RedisQueueInit, RedisQueueCreation>(new QueueConnection(queueName, connectionString), messageCount, runtime, timeOut, workerCount, readerCount, queueSize, linqMethodTypes, false, x => { }, Helpers.GenerateData, Helpers.Verify, VerifyQueueCount); }
public ConnectionInfo(ConnectionInfoTypes type) { _type = type; }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { //create data var id = Guid.NewGuid(); var producer = new ProducerMethodShared(); if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateRollBackCompiled, runtime, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false, id, GenerateMethod.CreateRollBackDynamic, runtime, null); } #endif //process data var consumer = new ConsumerMethodAsyncRollBackShared(); consumer.RunConsumer <RedisQueueInit>(queueName, connectionString, false, workerCount, logProvider, timeOut, readerCount, queueSize, runtime, messageCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12), id, "second(*%3)"); LoggerShared.CheckForErrors(queueName); using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } GenerateMethod.ClearRollback(id); } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
private void RunConsumer(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ITaskFactory factory, ConnectionInfoTypes type) { var queue = new SimpleConsumerAsync(); queue.Run(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, factory, type); }
public void Run( int messageCount, bool interceptors, bool batchSending, bool enableDelay, bool enableExpiration, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerMethodShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer <RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); if (enableExpiration && enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } else if (enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } else if (enableExpiration) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } else { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0, null); } #if NETFULL else { producer.RunTestDynamic <RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0, null); } #endif } } finally { using ( var oCreation = queueCreator.GetQueueCreation <RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ConnectionInfoTypes type) { SchedulerContainer schedulerContainer = null; if (Factory == null) { Factory = CreateFactory(workerCount, queueSize, out schedulerContainer); } var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var connectionString = new ConnectionInfo(type).ConnectionString; using (var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { if (messageType == 1) { var producer = new ProducerAsyncShared(); producer.RunTest<RedisQueueInit, FakeMessage>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared<FakeMessage> {Factory = Factory}; consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); } else if (messageType == 2) { var producer = new ProducerAsyncShared(); producer.RunTest<RedisQueueInit, FakeMessageA>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared<FakeMessageA> {Factory = Factory}; consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); } else if (messageType == 3) { var producer = new ProducerAsyncShared(); producer.RunTest<RedisQueueInit, FakeMessageB>(queueName, connectionString, false, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, false).Wait(timeOut * 1000 / 2); var consumer = new ConsumerAsyncShared<FakeMessageB> {Factory = Factory}; consumer.RunConsumer<RedisQueueInit>(queueName, connectionString, false, logProvider, runtime, messageCount, timeOut, readerCount, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(12)); } using (var count = new VerifyQueueRecordCount(queueName, connectionString)) { count.Verify(0, false, -1); } } finally { schedulerContainer?.Dispose(); using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
public void Run(int messageCount, int runtime, int timeOut, int workerCount, int readerCount, int queueSize, int messageType, ITaskFactory factory, ConnectionInfoTypes type) { Factory = factory; Run(messageCount, runtime, timeOut, workerCount, readerCount, queueSize, messageType, type); }
public void Run( int messageCount, bool interceptors, bool batchSending, bool enableDelay, bool enableExpiration, ConnectionInfoTypes type, LinqMethodTypes linqMethodTypes) { var queueName = GenerateQueueName.Create(); var logProvider = LoggerShared.Create(queueName, GetType().Name); var producer = new ProducerMethodShared(); var connectionString = new ConnectionInfo(type).ConnectionString; using ( var queueCreator = new QueueCreationContainer<RedisQueueInit>( serviceRegister => serviceRegister.Register(() => logProvider, LifeStyles.Singleton))) { try { var id = Guid.NewGuid(); if (enableExpiration && enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } else if (enableDelay) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateDelayData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } else if (enableExpiration) { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateExpiredData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } else { if (linqMethodTypes == LinqMethodTypes.Compiled) { producer.RunTestCompiled<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateCompiled, 0); } else { producer.RunTestDynamic<RedisQueueInit>(queueName, connectionString, interceptors, messageCount, logProvider, Helpers.GenerateData, Helpers.Verify, batchSending, id, GenerateMethod.CreateDynamic, 0); } } } finally { using ( var oCreation = queueCreator.GetQueueCreation<RedisQueueCreation>(queueName, connectionString) ) { oCreation.RemoveQueue(); } } } }
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); } } }