Esempio n. 1
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB_E9_Customer", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB_E9_Cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB_E9_Barista", QueueType.Standard);

            var customerHost = new DefaultHost();

            customerHost.Start <CustomerBootStrapper>();

            Console.WriteLine("Customer was started");
            Console.WriteLine("Waiting for order");
            Console.ReadLine();

            var bus = customerHost.Bus as IServiceBus;

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

            customer.BuyDrinkSync();

            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E12.Client", QueueType.Standard);

            var host = new DefaultHost();

            host.Start <ClientBootStrapper>();

            var bus = host.Bus as IServiceBus;

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


            var message = GetMessageWithLargeCollection();

            try
            {
                bus.Send(message);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            int    repeat      = 100;
            string machineName = "msmq://localhost/";
            string queueName   = "LearningRhinoESB.E3.Client";

            // argument 1: repeat
            if (args.Length == 1)
            {
                repeat = int.Parse(args[0]);
            }
            // argument 2: machine name
            if (args.Length == 2)
            {
                machineName = string.Format("msmq://{0}/", args[1]);
            }
            // argument 3: queue name
            if (args.Length == 3)
            {
                queueName = args[2];
            }
            // prepare queue
            PrepareQueues.Prepare(string.Format("{0}{1}", machineName, queueName), QueueType.Standard);
            var host = new DefaultHost();

            host.Start <ClientBootStrapper>();
            string machineId = string.Format("{0}/{1}", machineName, Guid.NewGuid());

            SendMessages(repeat, host, machineId);
            Console.WriteLine("Client 1: Hit enter to send message");
            Console.ReadLine();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E10.Backend", QueueType.Standard);

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

            var host = new DefaultHost();

            host.Start <BackendBootStrapper>();

            Console.ReadLine();;
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E5.Cashier", QueueType.Standard);

            var host = new DefaultHost();

            host.Start <CashierBootStrapper>();

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

            Console.ReadLine();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E5.Barista", QueueType.Standard);

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

            var host = new DefaultHost();

            host.Start <BaristaBootStrapper>();

            Console.ReadLine();
        }
Esempio n. 7
0
        public void Can_by_coffee_from_starbucks()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            var baristaLoadBalancer = new RemoteAppDomainLoadBalancerHost(typeof(RemoteAppDomainHost).Assembly, "LoadBalancer.config");

            baristaLoadBalancer.Start();

            Console.WriteLine("Barista load balancer has started");

            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.Start <CustomerBootStrapper>();

            var bus = customerHost.Container.Resolve <IServiceBus>();

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

            customer.BuyDrinkSync();

            cashier.Close();
            barista.Close();

            Assert.Equal("Ayende", userInterface.CoffeeRushName);
        }
        public IntegrationTest()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer.acceptingwork", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            baristaLoadBalancer = new RemoteAppDomainHost(typeof(SpringLoadBalancerBootStrapper).Assembly, "BaristaLoadBalancer.config");
            cashier             = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                                  .Configuration("Cashier.config");
            barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                      .Configuration("Barista.config");
            customerHost = new DefaultHost();
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            App_Start.NHibernateProfilerBootstrapper.PreStart();


            XmlConfigurator.Configure();
            // HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();


            PrepareQueues.Prepare("msmq://localhost/cqrs.sample", QueueType.Standard);

            _container = CreateContainer();
            _logger    = _container.Resolve <ILogger>();
            //_logger.SetInThreadContext("op_type", "blablabla");
            //_logger.Error("TEST", new NotImplementedException());
            ConfigureCommandSender();
            AutomapEventsForMongoDB();
            AutoMapSagaSampleForMongoDB();
            ConfigureQueryModelBuilder();
            ConfigureQueryModelRebuilder();
            ConfigureDomainEventHandlerInitializers();

            _container.Install(
                new RhinoServiceBusInstaller()
                );

            // rebuild the views if needed (it must be done before the bus starts)
            // todo: add some tracing and exclude sagas
            //DenormalizerRebuilder rebuilder = _container.Resolve<DenormalizerRebuilder>();
            //rebuilder.Rebuild();
            //_container.Release(rebuilder);

            //GM: Now initialization of the handler and discovering of specific support
            //This can be moved to the core if this concept of initialization is good.


            InitializeDomainEventsHandlers();

            _container.Resolve <IStartableBus>().Start();

            IStoreEvents store = _container.Resolve <IStoreEvents>();

            Console.WriteLine("Server is running");
            Console.ReadLine();
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E1.Client", QueueType.Standard);

            var host = new DefaultHost();

            host.Start <ClientBootStrapper>();

            var bus = host.Bus as IServiceBus;

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

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

            Console.ReadLine();
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E7.Barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E7.Cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E7.Customer", QueueType.Standard);

            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("msmq://localhost/LearningRhinoESB.E7.Customer")
                                          .Receive("Messages.Cashier", "msmq://localhost/LearningRhinoESB.E7.Cashier")
                                          .Receive("Messages.Barista", "msmq://localhost/LearningRhinoESB.E7.Barista"));
            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();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E5.Customer", QueueType.Standard);

            var host = new DefaultHost();

            host.Start <CustomerBootStrapper>();

            Console.WriteLine("Ayende: Visiting Starbucks ...");
            Console.ReadLine();

            var bus = host.Bus as IServiceBus;

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

            customer.BuyDrinkSync();

            Console.ReadLine();
        }