static async Task MainAsync(string[] args) { try { config.Connectionstring(Environment.GetEnvironmentVariable("MessageHandler.AzureServiceBus.Connectionstring")); config.ChannelId("consoleTopic"); config.DisruptorRingSize(1024); config.HandlerConfigurationId("consoleSubscription"); var pump = new SubscriptionPump(settings); var messageReceiverSettings = new MessageReceiverSettings() { NumberOfReceivers = 20, BatchSize = 1000, ServerWaitTime = TimeSpan.FromMilliseconds(100) }; config.MessageReceiverSettings(messageReceiverSettings); config.RegisterMessagePump(pump); config.UseEventProcessingRuntime(); int invocationCount = 0; Func <IProcessingContext, Task> pipeline = async ctx => { await Console.Out.WriteLineAsync(invocationCount ++ + " " + DateTime.Now.ToLongTimeString()); }; config.Pipeline(pipeline); var runtime = await HandlerRuntime.Create(config); await runtime.Start(); Console.WriteLine("Press a key to stop."); Console.ReadKey(); await runtime.Stop(); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); } }
static async Task MainAsync(string[] args) { try { config.Connectionstring( Environment.GetEnvironmentVariable("MessageHandler.AzureServiceBus.Connectionstring")); config.ChannelId("Console"); config.DisruptorRingSize(1024); var pump = new QueuePump(settings); var messageReceiverSettings = new MessageReceiverSettings() { NumberOfReceivers = 5, BatchSize = 100, ServerWaitTime = TimeSpan.FromSeconds(1) }; config.MessageReceiverSettings(messageReceiverSettings); config.RegisterMessagePump(pump); config.UseEventProcessingRuntime(); Func <IProcessingContext, Task> pipeline = ctx => Task.CompletedTask; config.Pipeline(pipeline); Console.WriteLine("Press a key to start."); Console.ReadKey(); bool YN = false; do { await SendMessage(); } while (YN == false); Console.WriteLine("Messages sent."); Console.ReadKey(); Console.WriteLine("Program finished."); Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); } }