示例#1
1
        /// <summary>
        /// Async method to validate specific cluster configuration
        /// </summary>
        /// <param name="config"></param>
        /// <returns>Task object of boolean type for this async method </returns>
        public async Task<bool> ValidateConfiguration(ClusterConfiguration config)
        {
            if (config.Globals.LivenessType == GlobalConfiguration.LivenessProviderType.AzureTable)
            {
                string deploymentId = config.Globals.DeploymentId ?? serviceRuntimeWrapper.DeploymentId;
                string connectionString = config.Globals.DataConnectionString ??
                                          serviceRuntimeWrapper.GetConfigurationSettingValue(DataConnectionConfigurationSettingName);

                try
                {
                    var manager = siloInstanceManager ?? await OrleansSiloInstanceManager.GetManager(deploymentId, connectionString);
                    var instances = await manager.DumpSiloInstanceTable();
                    logger.Verbose(instances);
                }
                catch (Exception exc)
                {
                    var error = String.Format("Connecting to the storage table has failed with {0}", LogFormatter.PrintException(exc));
                    Trace.TraceError(error);
                    logger.Error(ErrorCode.AzureTable_34, error, exc);
                    return false;
                }
            }

            return true;
        }
 /// <summary>
 /// Create stream queue balancer by type requested
 /// </summary>
 /// <param name="balancerType">queue balancer type to create</param>
 /// <param name="strProviderName">name of requesting stream provider</param>
 /// <param name="siloStatusOracle">membership services interface.</param>
 /// <param name="clusterConfiguration">cluster configuration</param>
 /// <param name="runtime">stream provider runtime environment to run in</param>
 /// <param name="queueMapper">queue mapper of requesting stream provider</param>
 /// <param name="siloMaturityPeriod">Maturity Period of a silo for queue rebalancing purposes</param>
 /// <returns>Constructed stream queue balancer</returns>
 public static IStreamQueueBalancer Create(
     StreamQueueBalancerType balancerType,
     string strProviderName,
     ISiloStatusOracle siloStatusOracle,
     ClusterConfiguration clusterConfiguration,
     IStreamProviderRuntime runtime,
     IStreamQueueMapper queueMapper,
     TimeSpan siloMaturityPeriod)
 {
     if (string.IsNullOrWhiteSpace(strProviderName))
     {
         throw new ArgumentNullException("strProviderName");
     }
     if (siloStatusOracle == null)
     {
         throw new ArgumentNullException("siloStatusOracle");
     }
     if (clusterConfiguration == null)
     {
         throw new ArgumentNullException("clusterConfiguration");
     }
     if (runtime == null)
     {
         throw new ArgumentNullException("runtime");
     }
     if (queueMapper == null)
     {
         throw new ArgumentNullException("queueMapper");
     }
     bool isFixed;
     switch (balancerType)
     {
         case StreamQueueBalancerType.ConsistentRingBalancer:
         {
             // Consider: for now re-use the same ConsistentRingProvider with 1 equally devided range. Remove later.
             IConsistentRingProviderForGrains ringProvider = runtime.GetConsistentRingProvider(0, 1);
             return new ConsistentRingQueueBalancer(ringProvider, queueMapper);
         }
         case StreamQueueBalancerType.DynamicAzureDeploymentBalancer:
         case StreamQueueBalancerType.StaticAzureDeploymentBalancer:
         {
             Logger logger = LogManager.GetLogger(typeof(StreamQueueBalancerFactory).Name, LoggerType.Runtime);
             var wrapper = AssemblyLoader.LoadAndCreateInstance<IDeploymentConfiguration>(Constants.ORLEANS_AZURE_UTILS_DLL, logger);
             isFixed = balancerType == StreamQueueBalancerType.StaticAzureDeploymentBalancer;
             return new DeploymentBasedQueueBalancer(siloStatusOracle, wrapper, queueMapper, siloMaturityPeriod, isFixed);
         }
         case StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer:
         case StreamQueueBalancerType.StaticClusterConfigDeploymentBalancer:
         {
             IDeploymentConfiguration deploymentConfiguration = new StaticClusterDeploymentConfiguration(clusterConfiguration);
             isFixed = balancerType == StreamQueueBalancerType.StaticClusterConfigDeploymentBalancer;
             return new DeploymentBasedQueueBalancer(siloStatusOracle, deploymentConfiguration, queueMapper, siloMaturityPeriod, isFixed);
         }
         default:
         {
             string error = string.Format("Unsupported balancerType for stream provider. BalancerType: {0}, StreamProvider: {1}", balancerType, strProviderName);
             throw new ArgumentOutOfRangeException("balancerType", error);
         }
     }
 }
        protected void Init(int mode = 1)
        {
            SiloHostConfig = new TestingSiloOptions
            {
                StartPrimary = true,
                ParallelStart = false,
                PickNewDeploymentId = true,
                StartFreshOrleans = true,
                StartSecondary = false,
                SiloConfigFile = new FileInfo("OrleansConfigurationForTesting.xml"),
                LivenessType = Orleans.Runtime.Configuration.GlobalConfiguration.LivenessProviderType.MembershipTableGrain,
                StartClient = true
            };

            var clientOptions = new TestingClientOptions
            {
                ProxiedGateway = true,
                Gateways = new List<IPEndPoint>(new[]
                    {
                        new IPEndPoint(IPAddress.Loopback, TestingSiloHost.ProxyBasePort),
                    }),
                PreferedGatewayIndex = 0
            };
            ClusterConfig = new ClusterConfiguration();
            ClusterConfig.LoadFromFile(new FileInfo("OrleansConfigurationForConsulTesting.xml").FullName);
            ClusterConfig.Globals.DataConnectionString = $"host=localhost;datacenter=dc1;mode={mode}";
            ClusterConfig.Globals.DataConnectionStringForReminders = $"host=localhost;datacenter=dc1;mode={mode}";
            SiloHost = new MyTestingHost(SiloHostConfig, clientOptions);
            ConsulMembershipTable = new ConsulSystemStoreProvider();
        }
        public static ClusterConfiguration GetClusterConfiguration()
        {
            var config = new ClusterConfiguration();

            // Configure logging and metrics collection.
            config.Defaults.TraceFilePattern = Path.GetTempPath() + "{0}_{1}.log";
            config.Defaults.StatisticsCollectionLevel = StatisticsLevel.Info;
            config.Defaults.StatisticsLogWriteInterval = TimeSpan.FromDays(6);
            config.Defaults.TurnWarningLengthThreshold = TimeSpan.FromSeconds(15);
            config.Defaults.TraceToConsole = true;
            config.Defaults.DefaultTraceLevel = Severity.Info;
            /*config.Defaults.TraceLevelOverrides.Add(Tuple.Create("Orleans", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("Runtime", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("Dispatcher", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("MembershipOracle", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("DeploymentLoadPublisher", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("ReminderService", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("SiloLogStatistics", Severity.Warning));*/
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("Catalog", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("sync.SafeTimerBase", Severity.Warning));
            config.Defaults.TraceLevelOverrides.Add(Tuple.Create("asynTask.SafeTimerBase", Severity.Warning));

            // Configure providers
            config.Globals.RegisterBootstrapProvider<RaftBootstrap>(new RaftBootstrap().Name);
            config.Globals.RegisterStorageProvider<MemoryStorage>("Default");
            config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain;
            config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.MembershipTableGrain;

            // Configure clustering.
            config.Globals.DeploymentId = "test";
            //config.Globals.ExpectedClusterSize = nodeList.Count; // An overestimate is tolerable.
            config.Globals.ResponseTimeout = TimeSpan.FromSeconds(90);

            return config;
        }
        public ClusterConfiguration GetClusterConfiguration()
        {
            var config = new ClusterConfiguration();

            var orleansConfig = new FabricConfigProvider<OrleansConfig>("OrleansConfig").Config;

            // Configure logging and metrics collection.
            //config.Defaults.StartupTypeName = typeof(SiloServiceLocator).AssemblyQualifiedName;
            config.Defaults.TraceFileName = null;
            config.Defaults.TraceFilePattern = null;
            config.Defaults.StatisticsCollectionLevel = StatisticsLevel.Info;
            config.Defaults.StatisticsLogWriteInterval = TimeSpan.FromSeconds(10);
            config.Defaults.TurnWarningLengthThreshold = TimeSpan.FromSeconds(15);
            config.Defaults.TraceToConsole = true;
            config.Defaults.DefaultTraceLevel = Severity.Info;

            // Configure providers
            //config.Globals.RegisterStorageProvider<AzureTableStorage>(
            //    "Default",
            //    new Dictionary<string, string>
            //    {
            //        { "DataConnectionString", "DefaultEndpointsProtocol=https;AccountName=actorchatstorage;AccountKey=1hCY/Ak2TFrqE61cMhbPU5rkv9PuDfX7QQFU4tXCSc2AO78hLdm6u3PrGrZbUzOj7OkIZ93YKbU81VSVnBMbPg==" },
            //        { "UseJsonFormat", true.ToString(CultureInfo.InvariantCulture) }
            //    });
            config.Globals.DataConnectionString = orleansConfig.DataConnectionString;
            config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.AzureTable;
            config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;

            //config.Globals.ExpectedClusterSize = nodeList.Count; // An overestimate is tolerable.
            config.Globals.ResponseTimeout = TimeSpan.FromSeconds(30);
	        config.Defaults.PropagateActivityId = true;
			
            return config;
        }
示例#6
0
 public InsideRuntimeClient(
     Dispatcher dispatcher,
     Catalog catalog,
     ILocalGrainDirectory directory,
     ClusterConfiguration config,
     IConsistentRingProvider ring,
     GrainTypeManager typeManager,
     TypeMetadataCache typeMetadataCache,
     Func<ISiloStatusOracle> siloStatusOracle,
     OrleansTaskScheduler scheduler)
 {
     this.dispatcher = dispatcher;
     MySilo = catalog.LocalSilo;
     this.directory = directory;
     ConsistentRingProvider = ring;
     Catalog = catalog;
     disposables = new List<IDisposable>();
     callbacks = new ConcurrentDictionary<CorrelationId, CallbackData>();
     Config = config;
     config.OnConfigChange("Globals/Message", () => ResponseTimeout = Config.Globals.ResponseTimeout);
     RuntimeClient.Current = this;
     this.typeManager = typeManager;
     this.Scheduler = scheduler;
     this.siloStatusOracle = new Lazy<ISiloStatusOracle>(siloStatusOracle);
     this.ConcreteGrainFactory = new GrainFactory(this, typeMetadataCache);
     RuntimeClient.Current = this;
 }
        public ClusterConfiguration GetClusterConfiguration()
        {
            var config = new ClusterConfiguration();

            // Configure logging and metrics collection.
            //config.Defaults.StartupTypeName = typeof(SiloServiceLocator).AssemblyQualifiedName;
            config.Defaults.TraceFileName = null;
            config.Defaults.TraceFilePattern = null;
            config.Defaults.StatisticsCollectionLevel = StatisticsLevel.Info;
            config.Defaults.StatisticsLogWriteInterval = TimeSpan.FromDays(6);
            config.Defaults.TurnWarningLengthThreshold = TimeSpan.FromSeconds(15);
            config.Defaults.TraceToConsole = true;
            config.Defaults.DefaultTraceLevel = Severity.Warning;

            // Configure providers
            /*config.Globals.RegisterStorageProvider<AzureTableStorage>(
                "Default",
                new Dictionary<string, string>
                {
                    { "DataConnectionString", "UseDevelopmentStorage=true" },
                    { "UseJsonFormat", true.ToString(CultureInfo.InvariantCulture) }
                });*/
            config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.AzureTable;
            config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;

            //config.Globals.ExpectedClusterSize = nodeList.Count; // An overestimate is tolerable.
            config.Globals.ResponseTimeout = TimeSpan.FromSeconds(90);

            return config;
        }
示例#8
0
 private static void AdjustConfig(ClusterConfiguration config)
 {
     // register stream provider
     config.AddMemoryStorageProvider("PubSubStore");
     config.Globals.RegisterStreamProvider<TestEventHubStreamProvider>(StreamProviderName, BuildProviderSettings());
     config.Globals.ClientDropTimeout = TimeSpan.FromSeconds(5);
 }
示例#9
0
 public override void AdjustForTest(ClusterConfiguration config)
 {
     base.AdjustForTest(config);
     config.Globals.DefaultPlacementStrategy = "ActivationCountBasedPlacement";
     config.Globals.NumMissedProbesLimit = 1;
     config.Globals.NumVotesForDeathDeclaration = 1;
 }
 public StaticClusterDeploymentConfiguration(ClusterConfiguration clusterConfiguration)
 {
     if (clusterConfiguration == null)
     {
         throw new ArgumentNullException("clusterConfiguration");
     }
     _clusterConfiguration = clusterConfiguration;
 }
示例#11
0
 /// <summary> Constructor </summary>
 /// <param name="siloName">Name of this silo.</param>
 /// <param name="configFile">Silo config file that will be used to initialize this silo.</param>
 public SiloHost(string siloName, FileInfo configFile)
     : this(siloName)
 {
     ConfigFileName = configFile.FullName;
     var config = new ClusterConfiguration();
     config.LoadFromFile(ConfigFileName);
     SetSiloConfig(config);
 }
 public ClusterConfiguration GetClusterConfiguration()
 {
     var config = new ClusterConfiguration();
     config.Globals.DeploymentId = Regex.Replace(this.Context.ServiceName.PathAndQuery.Trim('/'), "[^a-zA-Z0-9_]", "_");
     config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain;
     config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
     config.Globals.DataConnectionString = "UseDevelopmentStorage=true";
     return config;
 }
 internal ClientObserverRegistrar(SiloAddress myAddr, ILocalGrainDirectory dir, OrleansTaskScheduler scheduler, ClusterConfiguration config)
     : base(Constants.ClientObserverRegistrarId, myAddr)
 {
     grainDirectory = dir;
     myAddress = myAddr;
     this.scheduler = scheduler;
     orleansConfig = config;
     logger = LogManager.GetLogger(typeof(ClientObserverRegistrar).Name);
 }
示例#14
0
        /// <summary>Creates a new silo in a remote app domain and returns a handle to it.</summary>
        public static SiloHandle Create(string siloName, Silo.SiloType type, ClusterConfiguration config, NodeConfiguration nodeConfiguration, Dictionary<string, GeneratedAssembly> additionalAssemblies)
        {
            AppDomainSetup setup = GetAppDomainSetupInfo();

            var appDomain = AppDomain.CreateDomain(siloName, null, setup);

            // Load each of the additional assemblies.
            AppDomainSiloHost.CodeGeneratorOptimizer optimizer = null;
            foreach (var assembly in additionalAssemblies.Where(asm => asm.Value != null))
            {
                if (optimizer == null)
                {
                    optimizer =
                        (AppDomainSiloHost.CodeGeneratorOptimizer)
                        appDomain.CreateInstanceAndUnwrap(
                            typeof(AppDomainSiloHost.CodeGeneratorOptimizer).Assembly.FullName, typeof(AppDomainSiloHost.CodeGeneratorOptimizer).FullName, false,
                            BindingFlags.Default,
                            null,
                            null,
                            CultureInfo.CurrentCulture,
                            new object[] { });
                }

                optimizer.AddCachedAssembly(assembly.Key, assembly.Value);
            }

            var args = new object[] { siloName, type, config };

            var siloHost = (AppDomainSiloHost)appDomain.CreateInstanceAndUnwrap(
                typeof(AppDomainSiloHost).Assembly.FullName, typeof(AppDomainSiloHost).FullName, false,
                BindingFlags.Default, null, args, CultureInfo.CurrentCulture,
                new object[] { });

            appDomain.UnhandledException += ReportUnobservedException;
            appDomain.DoCallBack(RegisterPerfCountersTelemetryConsumer);

            siloHost.Start();

            var retValue = new AppDomainSiloHandle
            {
                Name = siloName,
                SiloHost = siloHost,
                NodeConfiguration = nodeConfiguration,
                SiloAddress = siloHost.SiloAddress,
                Type = type,
                AppDomain = appDomain,
                additionalAssemblies = additionalAssemblies,
#if !NETSTANDARD_TODO
                AppDomainTestHook = siloHost.AppDomainTestHook,
#endif
            };

            retValue.ImportGeneratedAssemblies();

            return retValue;
        }
示例#15
0
        public void TestInitialize()
        {
            MessagingStatisticsGroup.Init(false);

            var orleansConfig = new ClusterConfiguration();
            orleansConfig.StandardLoad();
            BufferPool.InitGlobalBufferPool(orleansConfig.Globals);

            SerializationManager.InitializeForTesting();
        }
示例#16
0
        public static ClusterConfiguration DefaultConfiguration()
        {
            var config = new ClusterConfiguration();

            config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
            config.Globals.DeploymentId = AzureClient.GetDeploymentId();
            config.Globals.DataConnectionString = AzureClient.GetDataConnectionString();

            return config;
        }
示例#17
0
        public MessageSerializerTests(ITestOutputHelper output)
        {
            this.output = output;
            MessagingStatisticsGroup.Init(false);

            var orleansConfig = new ClusterConfiguration();
            orleansConfig.StandardLoad();
            BufferPool.InitGlobalBufferPool(orleansConfig.Globals);

            SerializationManager.InitializeForTesting();
        }
        public void Register(ClusterConfiguration configuration)
        {
            if (IsPersistentStreamProvider())
            {
                configuration.Globals.RegisterStreamProvider(type.FullName, Name, properties);
                return;
            }

            properties.Add(StreamSubscriptionMatcher.TypeKey, type.AssemblyQualifiedName);
            configuration.Globals.RegisterStreamProvider(typeof(StreamSubscriptionMatcher).FullName, Name, properties);
        }
 public override void AdjustForTest(ClusterConfiguration config)
 {
     var settings = new Dictionary<string, string>
     {
         {PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE,StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer.ToString()},
         {PersistentStreamProviderConfig.STREAM_PUBSUB_TYPE, StreamPubSubType.ImplicitOnly.ToString()}
     };
     config.Globals.RegisterStreamProvider<ControllableTestStreamProvider>(StreamProviderName, settings);
     config.GetConfigurationForNode("Primary");
     config.GetConfigurationForNode("Secondary_1");
     base.AdjustForTest(config);
 }
        public static void ClassInitialize(TestContext testContext)
        {
            hostName = Dns.GetHostName();
            logger = TraceLogger.GetLogger("MembershipTablePluginTests", TraceLogger.LoggerType.Application);

            ClusterConfiguration cfg = new ClusterConfiguration();
            cfg.LoadFromFile("OrleansConfigurationForTesting.xml");
            TraceLogger.Initialize(cfg.GetConfigurationForNode("Primary"));

            TraceLogger.AddTraceLevelOverride("AzureTableDataManager", Severity.Verbose3);
            TraceLogger.AddTraceLevelOverride("OrleansSiloInstanceManager", Severity.Verbose3);
            TraceLogger.AddTraceLevelOverride("Storage", Severity.Verbose3);
        }
 /// <summary>
 /// start secondary
 /// </summary>
 /// <param name="port"></param>
 /// <param name="proxyPort"></param>
 public OrleansHostWrapper(int port, int proxyPort)
 {
     var config = new ClusterConfiguration();
     var siloAddress = new IPEndPoint(IPAddress.Loopback, 22222);
     config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.MembershipTableGrain;
     config.Globals.SeedNodes.Add(siloAddress);
     config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain;
     config.Defaults.HostNameOrIPAddress = "localhost";
     config.Defaults.Port = port;
     config.Defaults.ProxyGatewayEndpoint = new IPEndPoint(IPAddress.Loopback, proxyPort);
     config.PrimaryNode = siloAddress;
     siloHost = new SiloHost("secondary", config);
 }
示例#22
0
 public ClientObserverRegistrar(
     SiloInitializationParameters initializationParameters,
     ILocalGrainDirectory dir,
     OrleansTaskScheduler scheduler,
     ClusterConfiguration config)
     : base(Constants.ClientObserverRegistrarId, initializationParameters.SiloAddress)
 {
     grainDirectory = dir;
     myAddress = initializationParameters.SiloAddress;
     this.scheduler = scheduler;
     orleansConfig = config;
     logger = LogManager.GetLogger(typeof(ClientObserverRegistrar).Name);
 }
        private static SiloHost CreateSiloHost(AppDomain appDomain, ClusterConfiguration clusterConfig)
        {
            var args = new object[] { nameof(SiloInitializationIsRetryableTest), clusterConfig };

            return (SiloHost)appDomain.CreateInstanceFromAndUnwrap(
                "OrleansRuntime.dll",
                typeof(SiloHost).FullName,
                false,
                BindingFlags.Default,
                null,
                args,
                CultureInfo.CurrentCulture,
                new object[] { });
        }
示例#24
0
        public void Config_NewConfigTest()
        {
            TextReader input = File.OpenText("Config_TestSiloConfig.xml");
            ClusterConfiguration config = new ClusterConfiguration();
            config.Load(input);
            input.Close();

            Assert.AreEqual<int>(2, config.Globals.SeedNodes.Count, "Seed node count is incorrect");
            Assert.AreEqual<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 11111), config.Globals.SeedNodes[0], "First seed node is set incorrectly");
            Assert.AreEqual<IPEndPoint>(new IPEndPoint(IPAddress.IPv6Loopback, 22222), config.Globals.SeedNodes[1], "Second seed node is set incorrectly");

            Assert.AreEqual<int>(12345, config.Defaults.Port, "Default port is set incorrectly");
            Assert.AreEqual<string>("UnitTests.General.TestStartup,Tester", config.Defaults.StartupTypeName);

            NodeConfiguration nc;
            bool hasNodeConfig = config.TryGetNodeConfigurationForSilo("Node1", out nc);
            Assert.IsTrue(hasNodeConfig, "Node Node1 has config");
            Assert.AreEqual<int>(11111, nc.Port, "Port is set incorrectly for node Node1");
            Assert.IsTrue(nc.IsPrimaryNode, "Node1 should be primary node");
            Assert.IsTrue(nc.IsSeedNode, "Node1 should be seed node");
            Assert.IsFalse(nc.IsGatewayNode, "Node1 should not be gateway node");
            Assert.AreEqual<string>("UnitTests.General.TestStartup,Tester", nc.StartupTypeName, "Startup type should be copied automatically");

            hasNodeConfig = config.TryGetNodeConfigurationForSilo("Node2", out nc);
            Assert.IsTrue(hasNodeConfig, "Node Node2 has config");
            Assert.AreEqual<int>(22222, nc.Port, "Port is set incorrectly for node Node2");
            Assert.IsFalse(nc.IsPrimaryNode, "Node2 should not be primary node");
            Assert.IsTrue(nc.IsSeedNode, "Node2 should be seed node");
            Assert.IsTrue(nc.IsGatewayNode, "Node2 should be gateway node");

            hasNodeConfig = config.TryGetNodeConfigurationForSilo("Store", out nc);
            Assert.IsTrue(hasNodeConfig, "Node Store has config");
            Assert.AreEqual<int>(12345, nc.Port, "IP port is set incorrectly for node Store");
            Assert.IsFalse(nc.IsPrimaryNode, "Store should not be primary node");
            Assert.IsFalse(nc.IsSeedNode, "Store should not be seed node");
            Assert.IsFalse(nc.IsGatewayNode, "Store should not be gateway node");

            //IPAddress[] ips = Dns.GetHostAddresses("");
            //IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, 12345);
            //for (int i = 0; i < ips.Length; i++)
            //{
            //    if ((ips[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) && !IPAddress.Loopback.Equals(ips[i]))
            //    {
            //        ep = new IPEndPoint(ips[i], 12345);
            //        break;
            //    }
            //}

            //Assert.AreEqual<IPEndPoint>(ep, nc.Endpoint, "IP endpoint is set incorrectly for node Store");
        }
        private static string GetConnectionString(string connectionString, ClusterConfiguration config)
        {
            if(!string.IsNullOrWhiteSpace(connectionString))
            {
                return connectionString;
            }

            if(!string.IsNullOrWhiteSpace(config.Globals.DataConnectionString))
            {
                return config.Globals.DataConnectionString;
            }

            throw new ArgumentNullException(nameof(connectionString), "Parameter value and fallback value are both null or empty.");
        }
示例#26
0
        internal PlaygroundConfigurator(AppDomainSetup setup)
            : base(setup)
        {
            client = new ClientConfiguration()
                .LoadFromEmbeddedResource<PlaygroundConfigurator>("Client.xml");

            cluster = new ClusterConfiguration()
                .LoadFromEmbeddedResource<PlaygroundConfigurator>("Cluster.xml");

            cluster.Globals.LivenessType =
                GlobalConfiguration.LivenessProviderType.MembershipTableGrain;

            cluster.Globals.ReminderServiceType =
                GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SiloInitializationParameters"/> class. 
        /// </summary>
        /// <param name="name">The name of this silo.</param>
        /// <param name="type">The type of this silo.</param>
        /// <param name="config">The cluster configuration.</param>
        public SiloInitializationParameters(string name, Silo.SiloType type, ClusterConfiguration config)
        {
            this.ClusterConfig = config;
            this.Type = type;
            this.Name = name;
            this.ClusterConfig.OnConfigChange(
                "Defaults",
                () => this.NodeConfig = this.ClusterConfig.GetOrCreateNodeConfigurationForSilo(this.Name));

            if (this.NodeConfig.Generation == 0)
            {
                this.NodeConfig.Generation = SiloAddress.AllocateNewGeneration();
            }

            this.SiloAddress = SiloAddress.New(this.NodeConfig.Endpoint, this.NodeConfig.Generation);
        }
示例#28
0
        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = 12;

            var config = new ClusterConfiguration()
                .LoadFromEmbeddedResource<Program>("Orleans.xml");

            system = ActorSystem.Configure().Azure()
                .Cluster()
                .From(config)
                .Register(Assembly.GetExecutingAssembly())
                .Run<HubGateway.Bootstrapper>()
                .Done();

            return base.OnStart();
        }
示例#29
0
        public OrleansHostWrapper(ClusterConfiguration config, string[] args)
        {
            var siloArgs = SiloArgs.ParseArguments(args);
            if (siloArgs == null)
            {
                return;
            }

            if (siloArgs.DeploymentId != null)
            {
                config.Globals.DeploymentId = siloArgs.DeploymentId;
            }

            siloHost = new Orleans.Runtime.Host.SiloHost(siloArgs.SiloName, config);
            siloHost.LoadOrleansConfig();
        }
示例#30
0
文件: Program.cs 项目: Microsoft/Yams
        private static int StartSilo(string[] args)
        {
            // define the cluster configuration
            var config = new ClusterConfiguration();
            config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
            config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.AzureTable;
            config.Globals.DataConnectionString = "MY_DATA_CONNECTION_STRING";
            config.AddMemoryStorageProvider();
            config.AddAzureTableStorageProvider("AzureStore");
            config.Defaults.DefaultTraceLevel = Severity.Error;
            config.Defaults.Port = 100;
            config.Defaults.ProxyGatewayEndpoint = new IPEndPoint(config.Defaults.Endpoint.Address, 101);

            hostWrapper = new OrleansHostWrapper(config, args);
            return hostWrapper.Run();
        }
示例#31
0
 internal void InitNodeSettingsFromGlobals(ClusterConfiguration clusterConfiguration)
 {
     this.IsPrimaryNode = this.Endpoint.Equals(clusterConfiguration.PrimaryNode);
     this.IsSeedNode    = clusterConfiguration.Globals.SeedNodes.Contains(this.Endpoint);
 }