protected override void OnStart(string[] ignored) { try { if (string.IsNullOrEmpty(bootStrapper) == false) { var assembly = LoadAssembly(); var bootStrapperType = LoadBootStrapperType(assembly); host = new RemoteAppDomainHost(bootStrapperType); host.Configuration(cfg); } else { host = new RemoteAppDomainHost(asm, cfg); } if (string.IsNullOrEmpty(hostType) == false) { host.SetHostType(hostType); } host.Start(); } catch (Exception x) { Log.Fatal("Hosted service failed to start", x); throw; } }
protected override void OnStart(string[] ignored) { host = new RemoteAppDomainHost(asm, cfg); if (string.IsNullOrEmpty(hostType) == false) host.SetHostType(hostType); host.Start(); }
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); }
protected override void OnStart(string[] ignored) { host = new RemoteAppDomainHost(asm, cfg); if (string.IsNullOrEmpty(hostType) == false) { host.SetHostType(hostType); } host.Start(); }
static void Main(string[] args) { var host = new RemoteAppDomainHost(typeof(AlexandriaBootStrapper)); host.Start(); Console.WriteLine("Starting to process messages"); Console.ReadLine(); }
public BaseTesterTests() { XmlConfigurator.Configure(); stubBrokerHost = new DefaultHost(); stubBrokerHost.UseStandaloneCastleConfigurationFileName(@".\..\..\Tester\BrokerEndpoint.config"); stubBrokerHost.Start <TestBootstrapper>(); bus = stubBrokerHost.Container.Resolve <IServiceBus>(); testerHost = new RemoteAppDomainHost(typeof(TesterBootstrapper)); testerHost.Start(); }
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(); }
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 void And_accept_messages_from_there() { host.Start(); using (var bus = container.Resolve <IStartableServiceBus>()) { bus.Start(); using (bus.AddInstanceSubscription(this)) { bus.Send(new Uri("msmq://localhost/test_queue").ToEndpoint(), new StringMsg { Value = "hello" }); Assert.True(resetEvent.WaitOne(TimeSpan.FromSeconds(10), false)); Assert.Equal("olleh", reply); } } }
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(); }
protected override void OnStart(string[] ignored) { host = new RemoteAppDomainHost(args[0]); host.Start(); }
public void prepare_contest_submit_solution_save_result() { var realProblemDirectory = @".\..\..\Tester\TestPrograms\RealProblem"; var zip = File.ReadAllBytes(Path.Combine(realProblemDirectory, "tests2.zip")); var user = new User { DisplayName = "User" }; var contest = new Contest { Beginning = new DateTime(1990, 7, 7), Ending = new DateTime(1990, 7, 7), Type = "Icpc" }; var problem = new Problem { Contest = contest, Limits = new ResourceUsage { MemoryInBytes = int.MaxValue, TimeInMilliseconds = 100500 }, TestInfo = new TestInfo { Checker = new ProgramSource { LanguageId = "MSVC90Testlib", Code = File.ReadAllText(Path.Combine(realProblemDirectory, "check.cpp")) } } }; var submission = new Submission { Author = user, Problem = problem, Source = new ProgramSource { Code = File.ReadAllText(Path.Combine(realProblemDirectory, "tree_ai.cpp")), LanguageId = "MSVC90" }, SubmittedAt = contest.Beginning }; var brokerHost = new RemoteAppDomainHost(typeof(BrokerBootstrapper)); brokerHost.SetHostType(typeof(TestHost)); brokerHost.Start(); var testerHost = new RemoteAppDomainHost(typeof(TesterBootstrapper)); testerHost.SetHostType(typeof(TestHost)); testerHost.Start(); var webHost = new TestHost(@".\..\..\Integration\WebEndpoint.config"); webHost.Start <TestWebBootstrapper>(); var bus = webHost.Container.Resolve <IServiceBus>(); using (var factory = new TestDatabaseConfiguration().DatabaseConfiguration.BuildSessionFactory()) { using (var scope = new SessionScope(factory)) { var session = scope.Session; session.Save(user); session.Save(contest); session.Save(problem); session.Save(submission); } bus.Send(new UnpackTestInfo { ProblemId = problem.Id, ZipArchive = zip }); bus.Send(new JudgeSubmission { SubmissionId = submission.Id }); Thread.Sleep(100000); using (var scope = new SessionScope(factory)) { submission = scope.Session.Get <Submission>(submission.Id); Assert.Equal(SubmissionTestingStatus.Finished, submission.TestingStatus); Assert.NotNull(submission.Result); Assert.Contains("Accepted", submission.Result.Verdict); } } }