GetConfig() public method

Retrieves a new configuration from the current configuration with the root node being the supplied path.
public GetConfig ( string path ) : Config
path string The path that contains the configuration to retrieve.
return Config
示例#1
0
        public RemoteSettings(Config config)
        {
            //TODO: need to add value validation for each field
            Config = config;
            LogReceive = config.GetBoolean("akka.remote.log-received-messages");
            LogSend = config.GetBoolean("akka.remote.log-sent-messages");

            var bufferSizeLogKey = "akka.remote.log-buffer-size-exceeding";
            if (config.GetString(bufferSizeLogKey).ToLowerInvariant().Equals("off") ||
                config.GetString(bufferSizeLogKey).ToLowerInvariant().Equals("false"))
            {
                LogBufferSizeExceeding = Int32.MaxValue;
            }
            else
            {
                LogBufferSizeExceeding = config.GetInt(bufferSizeLogKey);
            }

            UntrustedMode = config.GetBoolean("akka.remote.untrusted-mode");
            TrustedSelectionPaths = new HashSet<string>(config.GetStringList("akka.remote.trusted-selection-paths"));
            RemoteLifecycleEventsLogLevel = config.GetString("akka.remote.log-remote-lifecycle-events") ?? "DEBUG";
            Dispatcher = config.GetString("akka.remote.use-dispatcher");
            if (RemoteLifecycleEventsLogLevel.Equals("on", StringComparison.OrdinalIgnoreCase)) RemoteLifecycleEventsLogLevel = "DEBUG";
            FlushWait = config.GetTimeSpan("akka.remote.flush-wait-on-shutdown");
            ShutdownTimeout = config.GetTimeSpan("akka.remote.shutdown-timeout");
            TransportNames = config.GetStringList("akka.remote.enabled-transports");
            Transports = (from transportName in TransportNames
                let transportConfig = TransportConfigFor(transportName)
                select new TransportSettings(transportConfig)).ToArray();
            Adapters = ConfigToMap(config.GetConfig("akka.remote.adapters"));
            BackoffPeriod = config.GetTimeSpan("akka.remote.backoff-interval");
            RetryGateClosedFor = config.GetTimeSpan("akka.remote.retry-gate-closed-for", TimeSpan.Zero);
            UsePassiveConnections = config.GetBoolean("akka.remote.use-passive-connections");
            SysMsgBufferSize = config.GetInt("akka.remote.system-message-buffer-size");
            SysResendTimeout = config.GetTimeSpan("akka.remote.resend-interval");
            SysResendLimit = config.GetInt("akka.remote.resend-limit");
            InitialSysMsgDeliveryTimeout = config.GetTimeSpan("akka.remote.initial-system-message-delivery-timeout");
            QuarantineSilentSystemTimeout = config.GetTimeSpan("akka.remote.quarantine-after-silence");
            SysMsgAckTimeout = config.GetTimeSpan("akka.remote.system-message-ack-piggyback-timeout");
            QuarantineDuration = config.GetTimeSpan("akka.remote.prune-quarantine-marker-after");

            StartupTimeout = config.GetTimeSpan("akka.remote.startup-timeout");
            CommandAckTimeout = config.GetTimeSpan("akka.remote.command-ack-timeout");

            WatchFailureDetectorConfig = config.GetConfig("akka.remote.watch-failure-detector");
            WatchFailureDetectorImplementationClass = WatchFailureDetectorConfig.GetString("implementation-class");
            WatchHeartBeatInterval = WatchFailureDetectorConfig.GetTimeSpan("heartbeat-interval");
            WatchUnreachableReaperInterval = WatchFailureDetectorConfig.GetTimeSpan("unreachable-nodes-reaper-interval");
            WatchHeartbeatExpectedResponseAfter = WatchFailureDetectorConfig.GetTimeSpan("expected-response-after");
        }
示例#2
0
 public Deployer(Settings settings)
 {
     _settings = settings;
     _deployment = settings.Config.GetConfig("akka.actor.deployment");
     _default = _deployment.GetConfig("default");
     Init();
 }
示例#3
0
 public RemoteSettings(Config config)
 {
     Config = config;
     LogReceive = config.GetBoolean("akka.remote.log-received-messages");
     LogSend = config.GetBoolean("akka.remote.log-sent-messages");
     UntrustedMode = config.GetBoolean("akka.remote.untrusted-mode");
     TrustedSelectionPaths = new HashSet<string>(config.GetStringList("akka.remote.trusted-selection-paths"));
     RemoteLifecycleEventsLogLevel = config.GetString("akka.remote.log-remote-lifecycle-events") ?? "DEBUG";
     if (RemoteLifecycleEventsLogLevel.Equals("on")) RemoteLifecycleEventsLogLevel = "DEBUG";
     FlushWait = config.GetMillisDuration("akka.remote.flush-wait-on-shutdown");
     ShutdownTimeout = config.GetMillisDuration("akka.remote.shutdown-timeout");
     TransportNames = config.GetStringList("akka.remote.enabled-transports");
     Transports = (from transportName in TransportNames
         let transportConfig = TransportConfigFor(transportName)
         select new TransportSettings(transportConfig)).ToArray();
     Adapters = ConfigToMap(config.GetConfig("akka.remote.adapters"));
     BackoffPeriod = config.GetMillisDuration("akka.remote.backoff-interval");
     RetryGateClosedFor = config.GetMillisDuration("akka.remote.retry-gate-closed-for", TimeSpan.Zero);
     UsePassiveConnections = config.GetBoolean("akka.remote.use-passive-connections");
     SysMsgBufferSize = config.GetInt("akka.remote.system-message-buffer-size");
     SysResendTimeout = config.GetMillisDuration("akka.remote.resend-interval");
     InitialSysMsgDeliveryTimeout = config.GetMillisDuration("akka.remote.initial-system-message-delivery-timeout");
     SysMsgAckTimeout = config.GetMillisDuration("akka.remote.system-message-ack-piggyback-timeout");
     QuarantineDuration = config.GetMillisDuration("akka.remote.prune-quarantine-marker-after");
     StartupTimeout = config.GetMillisDuration("akka.remote.startup-timeout");
     CommandAckTimeout = config.GetMillisDuration("akka.remote.command-ack-timeout");
 }
示例#4
0
        /// <summary>
        /// Should check the config and environment for possible erorrs.
        /// If any found, shod throw the exception to prevent node from starting.
        /// </summary>
        /// <param name="config">Full akka config</param>
        /// <exception cref="System.Exception">
        /// Thrown if there are error in configuration and/or environment
        /// </exception>
        public override void PreCheck(Config config)
        {
            if (config.GetConfig("ClusterKit.Web.Nginx.Configuration") == null)
            {
                throw new ConfigurationException("ClusterKit.Web.Nginx.Configuration is not defined");
            }

            CheckNginxConfigAccess(config);
            CheckNginxReloadCommandAccess(config);
        }
        public ForkJoinDispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisites) : base(config, prerequisites)
        {
            var dtp = config.GetConfig("dedicated-thread-pool");
            if (dtp == null || dtp.IsEmpty) throw new ConfigurationException(string.Format("must define section dedicated-thread-pool for ForkJoinDispatcher {0}", config.GetString("id", "unknown")));

            var settings = new DedicatedThreadPoolSettings(dtp.GetInt("thread-count"), 
                DedicatedThreadPoolConfigHelpers.ConfigureThreadType(dtp.GetString("threadtype", ThreadType.Background.ToString())),
                config.GetString("id"),
                DedicatedThreadPoolConfigHelpers.GetSafeDeadlockTimeout(dtp));
            _instance = new ForkJoinDispatcher(this, settings);
        }
示例#6
0
        public Config GetConfig(string path)
        {
            HoconValue value = GetNode(path);

            if (_fallback != null)
            {
                Config f = _fallback.GetConfig(path);
                return(new Config(new Config(value), f));
            }

            return(new Config(value));
        }
示例#7
0
        public ClusterSettings(Config config, string systemName)
        {
            //TODO: Requiring!
            var cc = config.GetConfig("akka.cluster");
            LogInfo = cc.GetBoolean("log-info");
            _failureDetectorConfig = cc.GetConfig("failure-detector");
            FailureDetectorImplementationClass = _failureDetectorConfig.GetString("implementation-class");
            HeartbeatInterval = _failureDetectorConfig.GetTimeSpan("heartbeat-interval");
            HeartbeatExpectedResponseAfter = _failureDetectorConfig.GetTimeSpan("expected-response-after");
            MonitoredByNrOfMembers = _failureDetectorConfig.GetInt("monitored-by-nr-of-members");

            SeedNodes = cc.GetStringList("seed-nodes").Select(Address.Parse).ToImmutableList();
            SeedNodeTimeout = cc.GetTimeSpan("seed-node-timeout");
            RetryUnsuccessfulJoinAfter = cc.GetTimeSpanWithOffSwitch("retry-unsuccessful-join-after");
            PeriodicTasksInitialDelay = cc.GetTimeSpan("periodic-tasks-initial-delay");
            GossipInterval = cc.GetTimeSpan("gossip-interval");
            GossipTimeToLive = cc.GetTimeSpan("gossip-time-to-live");
            LeaderActionsInterval = cc.GetTimeSpan("leader-actions-interval");
            UnreachableNodesReaperInterval = cc.GetTimeSpan("unreachable-nodes-reaper-interval");
            PublishStatsInterval = cc.GetTimeSpanWithOffSwitch("publish-stats-interval");

            var key = "down-removal-margin";
            DownRemovalMargin = cc.GetString(key).ToLowerInvariant().Equals("off") 
                ? TimeSpan.Zero
                : cc.GetTimeSpan("down-removal-margin");

            AutoDownUnreachableAfter = cc.GetTimeSpanWithOffSwitch("auto-down-unreachable-after");

            Roles = cc.GetStringList("roles").ToImmutableHashSet();
            MinNrOfMembers = cc.GetInt("min-nr-of-members");
            //TODO:
            //_minNrOfMembersOfRole = cc.GetConfig("role").Root.GetArray().ToImmutableDictionary(o => o. )
            _useDispatcher = cc.GetString("use-dispatcher");
            if (String.IsNullOrEmpty(_useDispatcher)) _useDispatcher = Dispatchers.DefaultDispatcherId;
            GossipDifferentViewProbability = cc.GetDouble("gossip-different-view-probability");
            ReduceGossipDifferentViewProbability = cc.GetInt("reduce-gossip-different-view-probability");
            SchedulerTickDuration = cc.GetTimeSpan("scheduler.tick-duration");
            SchedulerTicksPerWheel = cc.GetInt("scheduler.ticks-per-wheel");

            MinNrOfMembersOfRole = cc.GetConfig("role").Root.GetObject().Items
                .ToImmutableDictionary(kv => kv.Key, kv => kv.Value.GetObject().GetKey("min-nr-of-members").GetInt());

            VerboseHeartbeatLogging = cc.GetBoolean("debug.verbose-heartbeat-logging");

            var downingProviderClassName = cc.GetString("downing-provider-class");
            if (!string.IsNullOrEmpty(downingProviderClassName))
                DowningProviderType = Type.GetType(downingProviderClassName, true);
            else if (AutoDownUnreachableAfter.HasValue)
                DowningProviderType = typeof(AutoDowning);
            else
                DowningProviderType = typeof(NoDowning);
        }
 public PinnedDispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisites)
     : base(config, prerequisites)
 {
     var dtp = config.GetConfig("dedicated-thread-pool");
     if (dtp == null || dtp.IsEmpty)
     {
         _settings = DedicatedThreadPoolConfigHelpers.DefaultSingleThreadPoolSettings;
     }
     else
     {
         _settings = new DedicatedThreadPoolSettings(1,
         DedicatedThreadPoolConfigHelpers.ConfigureThreadType(dtp.GetString("threadtype", ThreadType.Background.ToString())),
         config.GetString("id"),
         DedicatedThreadPoolConfigHelpers.GetSafeDeadlockTimeout(dtp));
     }
 }
示例#9
0
        public ClusterSettings(Config config, string systemName)
        {
            //TODO: Requiring!
            var cc = config.GetConfig("akka.cluster");
            _logInfo = cc.GetBoolean("log-info");
            _failureDetectorConfig = cc.GetConfig("failure-detector");
            _failureDetectorImplementationClass = _failureDetectorConfig.GetString("implementation-class");
            _heartbeatInterval = _failureDetectorConfig.GetTimeSpan("heartbeat-interval");
            _heartbeatExpectedResponseAfter = _failureDetectorConfig.GetTimeSpan("expected-response-after");
            _monitoredByNrOfMembers = _failureDetectorConfig.GetInt("monitored-by-nr-of-members");

            _seedNodes = cc.GetStringList("seed-nodes").Select(Address.Parse).ToImmutableList();
            _seedNodeTimeout = cc.GetTimeSpan("seed-node-timeout");
            _retryUnsuccessfulJoinAfter = cc.GetTimeSpanWithOffSwitch("retry-unsuccessful-join-after");
            _periodicTasksInitialDelay = cc.GetTimeSpan("periodic-tasks-initial-delay");
            _gossipInterval = cc.GetTimeSpan("gossip-interval");
            _gossipTimeToLive = cc.GetTimeSpan("gossip-time-to-live");
            _leaderActionsInterval = cc.GetTimeSpan("leader-actions-interval");
            _unreachableNodesReaperInterval = cc.GetTimeSpan("unreachable-nodes-reaper-interval");
            _publishStatsInterval = cc.GetTimeSpanWithOffSwitch("publish-stats-interval");
            _downRemovalMargin = cc.GetTimeSpan("down-removal-margin");

            _autoDownUnreachableAfter = cc.GetTimeSpanWithOffSwitch("auto-down-unreachable-after");

            _roles = cc.GetStringList("roles").ToImmutableHashSet();
            _minNrOfMembers = cc.GetInt("min-nr-of-members");
            //TODO:
            //_minNrOfMembersOfRole = cc.GetConfig("role").Root.GetArray().ToImmutableDictionary(o => o. )
            //TODO: Ignored jmx
            _useDispatcher = cc.GetString("use-dispatcher");
            if (String.IsNullOrEmpty(_useDispatcher)) _useDispatcher = Dispatchers.DefaultDispatcherId;
            _gossipDifferentViewProbability = cc.GetDouble("gossip-different-view-probability");
            _reduceGossipDifferentViewProbability = cc.GetInt("reduce-gossip-different-view-probability");
            _schedulerTickDuration = cc.GetTimeSpan("scheduler.tick-duration");
            _schedulerTicksPerWheel = cc.GetInt("scheduler.ticks-per-wheel");
            _metricsEnabled = cc.GetBoolean("metrics.enabled");
            _metricsCollectorClass = cc.GetString("metrics.collector-class");
            _metricsInterval = cc.GetTimeSpan("metrics.collect-interval");
            _metricsGossipInterval = cc.GetTimeSpan("metrics.gossip-interval");
            _metricsMovingAverageHalfLife = cc.GetTimeSpan("metrics.moving-average-half-life");

            _minNrOfMembersOfRole = cc.GetConfig("role").Root.GetObject().Items
                .ToImmutableDictionary(kv => kv.Key, kv => kv.Value.GetObject().GetKey("min-nr-of-members").GetInt());

            _verboseHeartbeatLogging = cc.GetBoolean("debug.verbose-heartbeat-logging");
        }
示例#10
0
        /// <summary>
        /// Should check the config and environment for possible erorrs.
        /// If any found, shod throw the exception to prevent node from starting.
        /// </summary>
        /// <param name="config">Full akka config</param>
        /// <exception cref="System.Exception">
        /// Thrown if there are error in configuration and/or environment
        /// </exception>
        public override void PreCheck(Config config)
        {
            var configSection = config.GetConfig("ClusterKit.Web.Swagger.Publish");
            if (configSection == null)
            {
                throw new ConfigurationException("ClusterKit.Web.Swagger.Publish is not defined");
            }

            if (string.IsNullOrEmpty(configSection.GetString("publishDocPath")))
            {
                throw new ConfigurationException("ClusterKit.Web.Swagger.Publish.publishDocPath is not defined");
            }

            if (string.IsNullOrEmpty(configSection.GetString("publishUiPath")))
            {
                throw new ConfigurationException("ClusterKit.Web.Swagger.Publish.publishUiPath is not defined");
            }
        }
示例#11
0
 public static DefaultResizer FromConfig(Config resizerConfig)
 {
     return resizerConfig.GetBoolean("resizer.enabled") ? new DefaultResizer(resizerConfig.GetConfig("resizer")) : null;
 }
示例#12
0
        /// <summary>
        /// Checks that service has access to nginx config file
        /// </summary>
        /// <param name="config">Akka configuration</param>
        private static void CheckNginxReloadCommandAccess(Config config)
        {
            var reloadCommandConfig = config.GetConfig("ClusterKit.Web.Nginx.ReloadCommand");
            if (reloadCommandConfig != null)
            {
                var commandPath = reloadCommandConfig.GetString("Command");
                if (string.IsNullOrWhiteSpace(commandPath))
                {
                    throw new ConfigurationException("ClusterKit.Web.Nginx.ReloadCommand.Command is not defined");
                }

                // todo: actualy need to check Execute access
                CheckFileAccess(commandPath, FileIOPermissionAccess.Read);
            }
        }
示例#13
0
        private static DedicatedThreadPoolSettings ConfigureSettings(Config config)
        {
            var dtp = config.GetConfig("dedicated-thread-pool");
            var fje = config.GetConfig("fork-join-executor");
            if ((dtp == null || dtp.IsEmpty) && (fje == null || fje.IsEmpty)) throw new ConfigurationException(
                $"must define section 'dedicated-thread-pool' OR 'fork-join-executor' for fork-join-executor {config.GetString("id", "unknown")}");

            if (dtp != null && !dtp.IsEmpty)
            {
                var settings = new DedicatedThreadPoolSettings(dtp.GetInt("thread-count"),
                    DedicatedThreadPoolConfigHelpers.ConfigureThreadType(dtp.GetString("threadtype",
                        ThreadType.Background.ToString())),
                    config.GetString("id"),
                    DedicatedThreadPoolConfigHelpers.GetSafeDeadlockTimeout(dtp));
                return settings;
            }
            else
            {
                var settings = new DedicatedThreadPoolSettings(ThreadPoolConfig.ScaledPoolSize(fje.GetInt("parallelism-min"), 1.0, fje.GetInt("parallelism-max")),
                     name:config.GetString("id"));
                return settings;
            }
            
        }
示例#14
0
 public AkkaProtocolSettings(Config config)
 {
     TransportFailureDetectorConfig = config.GetConfig("akka.remote.transport-failure-detector");
     TransportFailureDetectorImplementationClass = TransportFailureDetectorConfig.GetString("implementation-class");
     TransportHeartBeatInterval = TransportFailureDetectorConfig.GetTimeSpan("heartbeat-interval");
 }
示例#15
0
 public Deployer(Settings settings)
 {
     this.settings = settings;
     deployment = settings.Config.GetConfig("akka.actor.deployment");
     @default = deployment.GetConfig("default");
 }