public static void Main() { PrepareQueues.Prepare("msmq://localhost/starbucks.barista"); PrepareQueues.Prepare("msmq://localhost/starbucks.cashier"); PrepareQueues.Prepare("msmq://localhost/starbucks.customer"); var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper)) .Configuration("Cashier.config"); cashier.Start(); Console.WriteLine("Cashier is started"); var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper)) .Configuration("Barista.config"); barista.Start(); Console.WriteLine("Barista is started"); var customerHost = new DefaultHost(); customerHost.Start<CustomerBootStrapper>(); var bus = customerHost.Container.Resolve<IServiceBus>(); var customer = new CustomerController(bus) { Drink = "Hot Chocolate", Name = "Ayende", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Console.ReadLine(); }
public void Can_by_coffee_from_starbucks() { baristaLoadBalancer.Start(); Console.WriteLine("Barista load balancer has started"); cashier.Start(); Console.WriteLine("Cashier has started"); barista.Start(); Console.WriteLine("Barista has started"); customerHost.Start<CustomerBootStrapper>(); var bus = (IServiceBus)customerHost.Bus; var userInterface = new MockCustomerUserInterface(); var customer = new CustomerController(bus) { CustomerUserInterface = userInterface, Drink = "Hot Chocolate", Name = "Ayende", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Assert.Equal("Ayende", userInterface.CoffeeRushName); }
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(); }
public void Can_by_coffee_from_starbucks() { baristaLoadBalancer.Start(); Console.WriteLine("Barista load balancer has started"); cashier.Start(); Console.WriteLine("Cashier has started"); barista.Start(); Console.WriteLine("Barista has started"); customerHost.Start <CustomerBootStrapper>(); var bus = (IServiceBus)customerHost.Bus; var userInterface = new MockCustomerUserInterface(); var customer = new CustomerController(bus) { CustomerUserInterface = userInterface, Drink = "Hot Chocolate", Name = "Ayende", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Assert.Equal("Ayende", userInterface.CoffeeRushName); }
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(); }
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 static void Main() { PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer); PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer.acceptingwork", QueueType.Raw); 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 RemoteAppDomainHost(typeof(CastleBootStrapper).Assembly, "BaristaLoadBalancer.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.BusConfiguration(c => c.Bus("msmq://localhost/starbucks.customer") .Receive("Starbucks.Messages.Cashier", "msmq://localhost/starbucks.cashier") .Receive("Starbucks.Messages.Barista", "msmq://localhost/starbucks.barista.balancer")); customerHost.Start <CustomerBootStrapper>(); var bus = (IServiceBus)customerHost.Bus; var customer = new CustomerController(bus) { Drink = "Hot Chocolate", Name = "Ayende", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Console.ReadLine(); }
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(); }
public static void Main() { 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); var baristaLoadBalancer = new RemoteAppDomainHost(typeof(SpringBootStrapper).Assembly, "BaristaLoadBalancer.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.BusConfiguration(c => c.Bus("msmq://localhost/starbucks.customer") .Receive("Starbucks.Messages.Cashier", "msmq://localhost/starbucks.cashier") .Receive("Starbucks.Messages.Barista", "msmq://localhost/starbucks.barista.balancer")); customerHost.Start<CustomerBootStrapper>(); var bus = (IServiceBus)customerHost.Bus; var customer = new CustomerController(bus) { Drink = "Hot Chocolate", Name = "Ayende", Size = DrinkSize.Venti }; customer.BuyDrinkSync(); Console.ReadLine(); }
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); }
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(); }
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(); }
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(); }