public static void Main() { var controller = new CookedRabbitController(new Interactor("localhost", "introductions")); controller.Receive((message) => { // message must start with "Hello my name is, " string validationString = "Hello my name is, "; if (message.Substring(0, validationString.Length) != validationString) { Console.WriteLine("Message received that is not valid"); return; } string ReceivedName = message.Substring(validationString.Length, message.Length - validationString.Length); Console.WriteLine($"Hello {ReceivedName}, I am your father!"); }); }
public static void Main() { Console.WriteLine("Please enter your name >"); var name = Console.ReadLine(); var controller = new CookedRabbitController(new Interactor("localhost", "introductions")); if (controller.Send($"Hello my name is, {name}")) { Console.WriteLine("Message sent successfully"); } else { Console.WriteLine("Message failed to send"); } Console.WriteLine("Press [enter] to exit."); Console.ReadLine(); }