Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IBusLog log = new BusLog();

            try
            {
                using (IBus bus = new Bus(@".\private$\testreq", @".\private$\", @".\private$\testack", null, null, log))
                {
                    bus.BusLoggingLevel = BusLoggingLevel.Diagnostic;

                    bus.RegisterHandler<ARequest, AResponse, AHandler>();
                    bus.RegisterHandler<BRequest, BResponse, BHandler>();
                    bus.RegisterHandler<CRequest, CResponse, CHandler>();
                    bus.RegisterHandler<DRequest, DResponse, DHandler>();

                    bus.StartListening();

                    log.Info("Server ready. Press Enter to quit.");
                    Console.ReadLine();

                    bus.StopListening();

                    Console.WriteLine("Total sent: " + bus.TotalSent);
                    Console.WriteLine("Total received: " + bus.TotalReceived);

                    Thread.Sleep(5000);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                Thread.Sleep(5000);
            }
        }