public static async Task Run(IBusSession busSession) { Console.WriteLine("Press 's' to send a valid message"); Console.WriteLine("Press 'e' to send a failed message"); Console.WriteLine("Press any key to exit"); while (true) { ConsoleKeyInfo key = Console.ReadKey(); Console.WriteLine(); Console.WriteLine(); switch (key.Key) { case ConsoleKey.S: #region SendingSmall await busSession.SendLocal(new CreateProductCommand { ProductId = "XJ128", ProductName = "Milk", ListPrice = 4, // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed // before it reaches MSMQ. Image = new byte[1024 * 1024 * 7] }); #endregion break; case ConsoleKey.E: try { #region SendingLarge await busSession.SendLocal(new CreateProductCommand { ProductId = "XJ128", ProductName = "Really long product name", ListPrice = 15, // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed // before it reaches MSMQ. Image = new byte[1024 * 1024 * 7] }); #endregion } catch { //so the console keeps on running } break; default: { return; } } } }
public static async Task Run(IBusSession busSession) { Console.WriteLine("Press 's' to send a valid message"); Console.WriteLine("Press 'e' to send a failed message"); Console.WriteLine("Press any key to exit"); while (true) { ConsoleKeyInfo key = Console.ReadKey(); Console.WriteLine(); Console.WriteLine(); switch (key.Key) { case ConsoleKey.S: #region SendingSmall await busSession.SendLocal(new CreateProductCommand { ProductId = "XJ128", ProductName = "Milk", ListPrice = 4, // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed // before it reaches MSMQ. Image = new byte[1024 * 1024 * 7] }); #endregion break; case ConsoleKey.E: try { #region SendingLarge await busSession.SendLocal(new CreateProductCommand { ProductId = "XJ128", ProductName = "Really long product name", ListPrice = 15, // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed // before it reaches MSMQ. Image = new byte[1024 * 1024 * 7] }); #endregion } catch { //so the console keeps on running } break; default: { return; } } } }
static async Task SendMessage(IBusSession busSession) { Message message = new Message(); await busSession.SendLocal(message); Console.WriteLine(); Console.WriteLine("Message sent"); }
static async Task SendMessage(IBusSession busSession) { Message message = new Message(); await busSession.SendLocal(message); Console.WriteLine(); Console.WriteLine("Message sent"); }
async Task Invoke(IDictionary <string, object> environment) { string messageBody = await GetMessageBody(environment).ConfigureAwait(false); IDictionary <string, string[]> requestHeaders = (IDictionary <string, string[]>)environment["owin.RequestHeaders"]; string typeName = requestHeaders["MessageType"].Single(); Type objectType = Type.GetType(typeName); object deserialize = Deserialize(messageBody, objectType); await busSession.SendLocal(deserialize).ConfigureAwait(false); }
public async Task Start(IBusSession session) { Console.WriteLine("sending message..."); for (int i = 0; i < 100; i++) { await session.SendLocal(new SearchGitHub { Repository = "NServiceBus", RepositoryOwner = "Particular", SearchFor = "IBus" }); } Console.WriteLine("message sent."); }
public async Task Start(IBusSession session) { await session.SendLocal(new MyMessage()); }
public async Task Start(IBusSession session) { await session.SendLocal(new MyMessage()); }