Пример #1
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("customer");

            var host = new DefaultHost();

            host.Start <CustomerBootStrapper>();

            Console.WriteLine("Ayende is visiting Starbucks ...");
            Console.WriteLine("Hit enter for buying a hot chocolate ...");

            //Give the other services a bit air to initialize.
            Console.ReadLine();

            var bus = host.Bus as IServiceBus;

            var customer = new CustomerController(bus)
            {
                Drink = "Hot Chocolate",
                Name  = "Starbucks Lover",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("barista");

            Console.WriteLine("Barista: Ready for drink preparation ...");

            var host = new DefaultHost();

            host.Start <BaristaBootStrapper>();

            Console.ReadLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("cashier");

            var host = new DefaultHost();

            host.Start <CashierBootStrapper>();

            Console.WriteLine("Cashier: Waiting for message . . . ");

            Console.ReadLine();
        }
Пример #4
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("backend");

            Console.WriteLine("Backend: Starting to listen for incoming messages ...");

            var host = new DefaultHost();

            host.Start <BackendBootStrapper>();

            Console.ReadLine();
        }
Пример #5
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("cashier");
            QueueUtil.PrepareQueue("barista");
            QueueUtil.PrepareQueue("customer");

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                          .Configuration("Cashier.config");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                          .Configuration("Barista.config");

            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();

            customerHost.BusConfiguration(c =>
            {
                c.Bus("rhino.queues://localhost:53000/LearningRhinoESB_E8_Customer", "customer");
                c.Receive("Messages.Cashier", "rhino.queues://localhost:52000/LearningRhinoESB_E8_Cashier");
                c.Receive("Messages.Barista", "rhino.queues://localhost:51000/LearningRhinoESB_E8_Barista");
                return(c);
            });

            customerHost.Start <CustomerBootStrapper>();

            var bus = customerHost.Bus as IServiceBus;

            var customer = new CustomerController(bus)
            {
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Console.ReadLine();
        }
Пример #6
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("client");

            var host = new DefaultHost();

            host.Start <ClientBootStrapper>();

            Console.WriteLine("Client 1: Hit enter to send message");
            Console.ReadLine();

            var bus = host.Bus as IServiceBus;

            bus.Send(new HelloWorldMessage
            {
                Content = "Hello World!!!"
            });

            Console.ReadLine();
        }