//go to each queue and print out the number of messages it contains private static void PrintQueueStatus() { System.Threading.Thread.Sleep(5000); System.Console.WriteLine("The inbound queue has {0} messages.", QueueUtils.GetMessageCount(inQpath)); if (QueueUtils.QueueExists(primaryServicePath)) { Console.WriteLine("The primary service queue has {0} messages.", QueueUtils.GetMessageCount(primaryServicePath)); } else { Console.WriteLine("The primary service queue does not exist."); } if (QueueUtils.QueueExists(backupServicePath)) { Console.WriteLine("The backup service queue has {0} messages.", QueueUtils.GetMessageCount(backupServicePath)); } else { Console.WriteLine("The backup service queue does not exist."); } if (QueueUtils.QueueExists(primaryLoggingPath)) { Console.WriteLine("The primary logging queue has {0} messages.", QueueUtils.GetMessageCount(primaryLoggingPath)); } else { Console.WriteLine("The primary logging queue does not exist."); } if (QueueUtils.QueueExists(backupLoggingPath)) { Console.WriteLine("The backup logging queue has {0} messages.", QueueUtils.GetMessageCount(backupLoggingPath)); } else { Console.WriteLine("The backup logging queue does not exist."); } }
//main method to run the four test cases static void Main(string[] args) { CreateAllQueues(); using (ServiceHost host = new ServiceHost(typeof(RoutingService))) { //uncomment this call and rename the provided App.config to something //else like App.config.example to run a Router configured via code //ConfigureRouterViaCode(host); host.Open(); System.Console.WriteLine("Routing Service Configured and Opened"); System.Console.WriteLine("Press Enter to Run Case 1"); System.Console.ReadLine(); RunMulticastErrorHandlingCase1(); } using (ServiceHost host = new ServiceHost(typeof(RoutingService))) { //uncomment this call and rename the provided App.config to something //else like App.config.example to run a Router configured via code //ConfigureRouterViaCode(host); host.Open(); System.Console.WriteLine("Press Enter to Run Case 2"); System.Console.ReadLine(); RunMulticastErrorHandlingCase2(); } using (ServiceHost host = new ServiceHost(typeof(RoutingService))) { //uncomment this call and rename the provided App.config to something //else like App.config.example to run a Router configured via code //ConfigureRouterViaCode(host); host.Open(); System.Console.WriteLine("Press Enter to Run Case 3"); System.Console.ReadLine(); RunMulticastErrorHandlingCase3(); } using (ServiceHost host = new ServiceHost(typeof(RoutingService))) { //uncomment this call and rename the provided App.config to something //else like App.config.example to run a Router configured via code //ConfigureRouterViaCode(host); host.Open(); System.Console.WriteLine("Press Enter to Run Case 4"); System.Console.ReadLine(); RunMulticastErrorHandlingCase4(); } System.Console.WriteLine("The System Dead Letter queue has {0} messages.", QueueUtils.GetMessageCount("FormatName:Direct=OS:.\\System$;DEADXACT")); System.Console.WriteLine("Press <Enter> to Quit"); System.Console.ReadLine(); EmptyQueues(); QueueUtils.DeleteQueue(Environment.MachineName + "\\private$\\backupServiceQueue"); QueueUtils.DeleteQueue(Environment.MachineName + "\\private$\\inQ"); }