public Processor(string endpoint, int concurrencyLevel, ISubscriptionManager subscriptionManager, ITransportFactory transportFactory, ILoggerFactory loggerFactory, IDependencyResolver resolver) { this.endpoint = endpoint; this.subscriptionManager = subscriptionManager; this.resolver = resolver; this.subscriptions = new HashSet <Subscription>(); this.registry = new Dictionary <string, Dictionary <string, IMessageHandler> >(); this.worker = new MessageWorker( transportFactory.CreateInboundTransport(endpoint: endpoint), new DiagnosticsDispatcher(this), // TODO: build proper pipeline support loggerFactory, concurrencyLevel); }
public void TestConcurrencyLevelIsRespected(int concurrencyLevel, int nMessages, int processingTime) { var evt = new ManualResetEvent(false); // TODO: this test isn't testing any behaviour so far.. // just ensuring the worker can cope with high number of messages var receiver = SetupReceiver(nMessages); var dispatcher = SetupDispatcher(nMessages, processingTime, evt); using (var processor = new MessageWorker(receiver, dispatcher, new NullLoggerFactory(), concurrencyLevel)) { processor.Start(); Task.Delay(TimeSpan.FromMinutes(15)).ContinueWith(t => evt.Set()); evt.WaitOne(); } }