private static void Run() { var config = GetClusterConfiguration(); config.Globals.SeedNodes.Add(new IPEndPoint(IPAddress.Loopback, 11111)); config.Defaults.HostNameOrIPAddress = "localhost"; config.Defaults.Port = 11111; config.Defaults.ProxyGatewayEndpoint = new IPEndPoint(IPAddress.Loopback, 12345); var process = Process.GetCurrentProcess(); var name = Environment.MachineName + "_" + process.Id + Guid.NewGuid().ToString("N").Substring(3); var silo = new SiloHost(name, config); // Configure the silo for the current environment. silo.SetSiloType(Silo.SiloType.Primary); Trace.TraceInformation("Silo configuration: \n" + silo.Config.ToString(name)); silo.InitializeOrleansSilo(); Trace.TraceInformation("Successfully initialized Orleans silo '{0}' as a {1} node.", silo.Name, silo.Type); Trace.TraceInformation("Starting Orleans silo '{0}' as a {1} node.", silo.Name, silo.Type); if (silo.StartOrleansSilo()) { silo.WaitForOrleansSiloShutdown(); } }
/// <summary> /// Run method helper. /// </summary> /// <remarks> /// Makes this Orleans silo begin executing and become active. /// Note: This method call will only return control back to the caller when the silo is shutdown or /// an external request for cancellation has been issued. /// </remarks> /// <param name="cancellationToken">Optional cancellation token.</param> private void RunImpl(CancellationToken?cancellationToken = null) { logger.Info(ErrorCode.Runtime_Error_100289, "OrleansAzureHost entry point called"); // Hook up to receive notification of Azure role stopping events serviceRuntimeWrapper.SubscribeForStoppingNotification(this, HandleAzureRoleStopping); if (host.IsStarted) { if (cancellationToken.HasValue) { host.WaitForOrleansSiloShutdown(cancellationToken.Value); } else { host.WaitForOrleansSiloShutdown(); } } else { throw new Exception("Silo failed to start correctly - aborting"); } }
/// <summary> /// Makes this Orleans silo begin executing and become active. /// Note: This method call will only return control back to the caller when the silo is shutdown. /// </summary> public void Run() { logger.Info(ErrorCode.Runtime_Error_100289, "OrleansAzureHost entry point called"); // Hook up to receive notification of Azure role stopping events RoleEnvironment.Stopping += HandleAzureRoleStopping; if (host.IsStarted) { host.WaitForOrleansSiloShutdown(); } else { throw new ApplicationException("Silo failed to start correctly - aborting"); } }