예제 #1
0
 protected override void OnStop()
 {
     if (host != null)
     {
         host.Close();
     }
 }
예제 #2
0
        public void InitialDeployment(string user)
        {
            var tmpHost = new RemoteAppDomainHost(asm, cfg);

            tmpHost.InitialDeployment(user);
            tmpHost.Close();
        }
예제 #3
0
 public void Dispose()
 {
     baristaLoadBalancer.Close();
     customerHost.Dispose();
     cashier.Close();
     barista.Close();
 }
예제 #4
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);
        }
예제 #5
0
 protected override void OnStop()
 {
     try
     {
         if (host != null)
         {
             host.Close();
         }
     }
     catch (Exception x)
     {
         Log.Fatal("Hosted service failed to stop", x);
         throw;
     }
 }
예제 #6
0
        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();
        }
예제 #7
0
 public override void Dispose()
 {
     base.Dispose();
     host.Close();
 }
예제 #8
0
 public void InitialDeployment(string user)
 {
     var tmpHost = new RemoteAppDomainHost(asm, cfg);
     tmpHost.InitialDeployment(user);
     tmpHost.Close();
 }