public override Deploy ParseConfig(string key, Config config) { Config config2 = config; if (config.HasPath("cluster.enabled") && config.GetBoolean("cluster.enabled") && !config.HasPath("nr-of-instances")) { var maxTotalNrOfInstances = config .WithFallback(ClusterConfigFactory.Default()) .GetInt("cluster.max-total-nr-of-instances"); config2 = ConfigurationFactory.ParseString("nr-of-instances=" + maxTotalNrOfInstances) .WithFallback(config); } var deploy = base.ParseConfig(key, config2); if (deploy != null) { if (deploy.Config.GetBoolean("cluster.enabled")) { if (deploy.Scope != Deploy.NoScopeGiven) { throw new ConfigurationException(string.Format("Cluster deployment can't be combined with scope [{0}]", deploy.Scope)); } if (deploy.RouterConfig is RemoteRouterConfig) { throw new ConfigurationException(string.Format("Cluster deployment can't be combined with [{0}]", deploy.Config)); } if (deploy.RouterConfig is Pool) { return (deploy.WithScope(scope: ClusterScope.Instance) .WithRouterConfig(new ClusterRouterPool(deploy.RouterConfig as Pool, ClusterRouterPoolSettings.FromConfig(deploy.Config)))); } else if (deploy.RouterConfig is Group) { return (deploy.WithScope(scope: ClusterScope.Instance) .WithRouterConfig(new ClusterRouterGroup(deploy.RouterConfig as Group, ClusterRouterGroupSettings.FromConfig(deploy.Config)))); } else { throw new ArgumentException(string.Format("Cluster-aware router can only wrap Pool or Group, got [{0}]", deploy.RouterConfig.GetType())); } } else { return(deploy); } } else { return(null); } }
public ClusterActorRefProvider(string systemName, Settings settings, EventStream eventStream /*DynamicAcccess*/) : base(systemName, settings, eventStream) { var clusterConfig = ClusterConfigFactory.Default(); settings.InjectTopLevelFallback(clusterConfig); Deployer = new ClusterDeployer(settings); }
public LeaseMajoritySpec(ITestOutputHelper output) : base(output) { _default = ConfigurationFactory.ParseString(@" akka.cluster.split-brain-resolver.lease-majority.lease-implementation = ""akka.coordination.lease.kubernetes"" ") .WithFallback(ClusterConfigFactory.Default()); _blank = ConfigurationFactory.ParseString(@" akka.cluster.split-brain-resolver.lease-majority { lease-name = "" "" }").WithFallback(_default); _named = ConfigurationFactory.ParseString(@" akka.cluster.split-brain-resolver.lease-majority { lease-name = ""shopping-cart-akka-sbr"" }").WithFallback(_default); }