protected override void OnStop() { if (host != null) { host.Close(); } }
public void InitialDeployment(string user) { var tmpHost = new RemoteAppDomainHost(asm, cfg); tmpHost.InitialDeployment(user); tmpHost.Close(); }
public void Dispose() { baristaLoadBalancer.Close(); customerHost.Dispose(); cashier.Close(); barista.Close(); }
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); }
protected override void OnStop() { try { if (host != null) { host.Close(); } } catch (Exception x) { Log.Fatal("Hosted service failed to stop", x); throw; } }
private static void Main() { String appConfig = Assembly.GetEntryAssembly().Location + ".config"; var bootstrapper = new Bootstrapper(appConfig); var host = new RemoteAppDomainHost(bootstrapper.GetType()); host.Start(); Microsoft.Isam.Esent.Interop.SystemParameters.CacheSizeMax = 512; Console.WriteLine("{0} is {1}running with server GC.", Assembly.GetEntryAssembly().GetName().Name, GCSettings.IsServerGC == true ? String.Empty : "not "); Console.ReadKey(true); host.Close(); }
public override void Dispose() { base.Dispose(); host.Close(); }