public GetString ( string path, string @default = null ) : string | ||
path | string | The path that contains the value to retrieve. |
@default | string | |
Résultat | string |
/// <summary> /// Performs configuration /// </summary> /// <param name="configuration">Previous configuration</param> /// <param name="config">Akka configuration</param> /// <returns>Updated configuration</returns> public LoggerConfiguration Configure(LoggerConfiguration configuration, Config config) { var minimumLevel = config.GetString("ClusterKit.Log.ElasticSearch.minimumLevel", "none")?.Trim(); LogEventLevel level; if (!Enum.TryParse(minimumLevel, true, out level)) { return configuration; } var nodes = config.GetStringList("ClusterKit.Log.ElasticSearch.nodes"); var indexFormat = config.GetString("ClusterKit.Log.ElasticSearch.indexFormat", "logstash-{0:yyyy.MM.dd}"); Log.Information( "{Type}: \n\tMinimum level: {MinimumLevel}\n\tIndex format: {IndexFormat}\n\tNodes:\n\t\t{NodeList}\n", this.GetType().FullName, minimumLevel, indexFormat, string.Join("\n\t\t", nodes)); SelfLog.Enable(Console.WriteLine); var options = new ElasticsearchSinkOptions(nodes.Select(s => new Uri(s))) { MinimumLogEventLevel = level, AutoRegisterTemplate = true, IndexFormat = indexFormat }; return configuration.WriteTo.Elasticsearch(options); }
/// <summary> /// Creates cluster publish subscribe settings from provided configuration with the same layout as `akka.cluster.pub-sub`. /// </summary> public static DistributedPubSubSettings Create(Config config) { RoutingLogic routingLogic = null; var routingLogicName = config.GetString("routing-logic"); switch (routingLogicName) { case "random": routingLogic = new RandomLogic(); break; case "round-robin": routingLogic = new RoundRobinRoutingLogic(); break; case "broadcast": routingLogic = new BroadcastRoutingLogic(); break; case "consistent-hashing": throw new ArgumentException("Consistent hashing routing logic cannot be used by the pub-sub mediator"); default: throw new ArgumentException("Unknown routing logic is tried to be applied to the pub-sub mediator: " + routingLogicName); } return new DistributedPubSubSettings( config.GetString("role"), routingLogic, config.GetTimeSpan("gossip-interval"), config.GetTimeSpan("removed-time-to-live"), config.GetInt("max-delta-elements")); }
public SessionSettings(Config config) { if (config == null) throw new ArgumentNullException("config"); Builder = Cluster.Builder(); // Get IP and port configuration int port = config.GetInt("port", 9042); IPEndPoint[] contactPoints = ParseContactPoints(config.GetStringList("contact-points"), port); Builder.AddContactPoints(contactPoints); // Support user/pass authentication if (config.HasPath("credentials")) Builder.WithCredentials(config.GetString("credentials.username"), config.GetString("credentials.password")); // Support SSL if (config.GetBoolean("ssl")) Builder.WithSSL(); // Support compression string compressionTypeConfig = config.GetString("compression"); if (compressionTypeConfig != null) { var compressionType = (CompressionType) Enum.Parse(typeof (CompressionType), compressionTypeConfig, true); Builder.WithCompression(compressionType); } }
public static ClusterSingletonManagerSettings Create(Config config) { return new ClusterSingletonManagerSettings( singletonName: config.GetString("singleton-name"), role: RoleOption(config.GetString("role")), removalMargin: TimeSpan.Zero, // defaults to ClusterSettins.DownRemovalMargin handOverRetryInterval: config.GetTimeSpan("hand-over-retry-interval")); }
public SnapshotStoreSettings(Config config) { if (config == null) throw new ArgumentNullException("config", "SqlServer snapshot store settings cannot be initialized, because required HOCON section couldn't been found"); ConnectionString = config.GetString("connection-string"); ConnectionTimeout = config.GetTimeSpan("connection-timeout"); SchemaName = config.GetString("schema-name"); TableName = config.GetString("table-name"); }
public UserWorker(ClusterNodeContext context, Config config) { _context = context; _channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true); _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0)); var connectAddress = config.GetString("connect-address"); var connectPort = config.GetInt("connect-port", _listenEndPoint.Port); _connectEndPoint = new IPEndPoint(connectAddress != null ? IPAddress.Parse(connectAddress) : IPAddress.Loopback, connectPort); }
public static ClusterSingletonManagerSettings Create(Config config) { var role = config.GetString("role"); if (role == string.Empty) role = null; return new ClusterSingletonManagerSettings( singletonName: config.GetString("singleton-name"), role: role, removalMargin: TimeSpan.MinValue, handOverRetryInterval: config.GetTimeSpan("hand-over-retry-interval")); }
public TcpTransport(ActorSystem system, Config config) : base(system, config) { string protocol = "akka." + config.GetString("transport-protocol"); SchemeIdentifier = protocol; string host = config.GetString("hostname"); int port = config.GetInt("port"); Address = new Address(protocol, system.Name, host, port); log = Logging.GetLogger(system, this); server = new TcpServer(system, Address); }
public static ClusterSingletonProxySettings Create(Config config) { var role = config.GetString("role"); if (role == string.Empty) role = null; return new ClusterSingletonProxySettings( singletonName: config.GetString("singleton-name"), role: role, singletonIdentificationInterval: config.GetTimeSpan("singleton-identification-interval"), bufferSize: config.GetInt("buffer-size")); }
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); }
public JournalSettings(Config config) { if (config == null) throw new ArgumentNullException("config", "SqlServer journal settings cannot be initialized, because required HOCON section couldn't been found"); ConnectionString = config.GetString("connection-string"); ConnectionStringName = config.GetString("connection-string-name"); ConnectionTimeout = config.GetTimeSpan("connection-timeout"); SchemaName = config.GetString("schema-name"); TableName = config.GetString("table-name"); TimestampProvider = config.GetString("timestamp-provider"); }
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"); }
private IAutoSubscription GetSubscription(Akka.Configuration.Config config) { var topicpattern = config.GetString("kafka.topic-pattern"); var topics = config.GetStringList("kafka.topics").ToArray(); return(topicpattern != null?Subscriptions.TopicPattern(topicpattern) : Subscriptions.Topics(topics)); }
/// <summary> /// Performs configuration /// </summary> /// <param name="configuration">Previous configuration</param> /// <param name="config">Akka configuration</param> /// <returns>Updated configuration</returns> public LoggerConfiguration Configure(LoggerConfiguration configuration, Config config) { var templateName = config.GetString("ClusterKit.NodeManager.NodeTemplate"); return string.IsNullOrWhiteSpace(templateName) ? configuration : configuration.Enrich.WithProperty("nodeTemplate", templateName); }
public JournalSettings(Config config) { if (config == null) throw new ArgumentNullException("config", "Table Storage journal settings cannot be initialized, because required HOCON section couldn't be found"); TableName = config.GetString("table-name"); ConnectionStrings = config.GetStringList("connection-strings"); _settings = new AzureStorageSettings(ConnectionStrings); }
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"); }
public PinnedDispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisites) : base(config, prerequisites) { _executorServiceConfigurator = new ForkJoinExecutorServiceFactory(ForkJoinExecutorServiceFactory.SingleThreadDefault.WithFallback("id=" + config.GetString("id")), Prerequisites); // We don't bother trying to support any other type of exectuor here. PinnedDispatcher doesn't support them }
public static ClusterRouterGroupSettings FromConfig(Config config) { return new ClusterRouterGroupSettings( GetMaxTotalNrOfInstances(config), ImmutableHashSet.Create(config.GetStringList("routees.paths").ToArray()), config.GetBoolean("cluster.allow-local-routees"), UseRoleOption(config.GetString("cluster.use-role"))); }
private static void ConfigExceptionHandling(Config config) { ErrorStore.Setup(config.GetString("service.name"), new JSONErrorStore(config.GetString("service.exceptions-path"), 200)); AppDomain.CurrentDomain.UnhandledException += (sender, e) => { if (isLoggingException) return; using (new DelegateDisposable(() => isLoggingException = true, () => isLoggingException = false)) { var ex = e.ExceptionObject as Exception; if (ex != null) { try { ErrorStore.LogExceptionWithoutContext(ex); } catch (Exception) { Log.Fatal(ex); } } } }; AppDomain.CurrentDomain.FirstChanceException += (sender, e) => { if (isLoggingException) return; using (new DelegateDisposable(() => isLoggingException = true, () => isLoggingException = false)) { var ex = e.Exception; if (ex != null) { try { ErrorStore.LogExceptionWithoutContext(ex); } catch (Exception) { Log.Info(ex); } } } }; }
internal static ApartmentState GetApartmentState(Config cfg) { var s = cfg.GetString("apartment"); return string.Compare(s, "sta", StringComparison.InvariantCultureIgnoreCase) == 0 ? ApartmentState.STA : string.Compare(s, "mta", StringComparison.InvariantCultureIgnoreCase) == 0 ? ApartmentState.MTA : ApartmentState.Unknown; }
protected override Scope ParseScope(Config config) { var remote = config.GetString("remote"); if (remote == null) return Deploy.NoScopeGiven; var path = ActorPath.Parse(remote); var address = path.Address; return new RemoteScope(address); }
/// <summary> /// Should check the config and environment for possible errors. /// 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 connectionString = config.GetString(NodeManagerActor.ConfigConnectionStringPath); if (string.IsNullOrEmpty(connectionString)) { throw new ConfigurationException($"{NodeManagerActor.ConfigConnectionStringPath} is not defined"); } var databaseName = config.GetString(NodeManagerActor.ConfigDatabaseNamePath); if (string.IsNullOrEmpty(databaseName)) { throw new ConfigurationException($"{NodeManagerActor.ConfigDatabaseNamePath} is not defined"); } var packageRepository = config.GetString(NodeManagerActor.PackageRepositoryUrlPath); if (string.IsNullOrEmpty(packageRepository)) { throw new ConfigurationException($"{NodeManagerActor.ConfigDatabaseNamePath} is not defined"); } }
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); }
/// <summary> /// Create settings from a configuration with the same layout as the default configuration "akka.cluster.client.receptionist". /// </summary> public static ClusterReceptionistSettings Create(Config config) { var role = config.GetString("role"); if (string.IsNullOrEmpty(role)) role = null; return new ClusterReceptionistSettings( role, config.GetInt("number-of-contacts"), config.GetTimeSpan("response-tunnel-receive-timeout"), config.GetTimeSpan("heartbeat-interval"), config.GetTimeSpan("acceptable-heartbeat-pause"), config.GetTimeSpan("failure-detection-interval")); }
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"); 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(); }
/// <summary> /// Creates simple actor from config /// </summary> /// <param name="context">Current actor context (will create child actor)</param> /// <param name="actorConfig">Configuration to create from</param> /// <param name="windsorContainer">Dependency resolver</param> /// <param name="currentPath">Parent (current) actor path</param> /// <param name="pathName">New actor's path name</param> protected override void CreateSimpleActor( IActorContext context, Config actorConfig, IWindsorContainer windsorContainer, string currentPath, string pathName) { var childTypeName = actorConfig.GetString("type"); if (string.IsNullOrWhiteSpace(childTypeName)) { return; } var type = Type.GetType(childTypeName); if (type != null) { context.GetLogger() .Info( // ReSharper disable FormatStringProblem "{Type}: {NameSpaceName} initializing {ActorType} on {PathString}", // ReSharper restore FormatStringProblem typeof(NameSpaceActor).Name, currentPath, type.Name, pathName); if (type == typeof(NameSpaceActor) || type == typeof(NameSpaceForwarder)) { // this is done for tests, otherwise it would lead to CircularDependencyException context.ActorOf(Props.Create(() => new NameSpaceForwarder(windsorContainer, this.testActor)), pathName); } else { context.ActorOf(Context.System.DI().Props(type), pathName); } } else { context.GetLogger() .Error( // ReSharper disable FormatStringProblem "{Type}: {ClassTypeString} was not found for actor {NameSpaceName}/{PathString}", // ReSharper restore FormatStringProblem typeof(NameSpaceActor).Name, childTypeName, currentPath, pathName); } }
protected override Scope ParseScope(Config config) { var remote = config.GetString("remote"); if (remote == null) return Deploy.NoScopeGiven; ActorPath actorPath; if(ActorPath.TryParse(remote, out actorPath)) { var address = actorPath.Address; return new RemoteScope(address); } throw new ConfigurationException(string.Format("unparseable remote node name [{0}]", "ARG0")); }
/// <summary> /// Java API: Create settings from a configuration with the same layout as the default configuration 'akka.cluster.client'. /// </summary> public static ClusterClientSettings Create(Config config) { var initialContacts = config.GetStringList("initial-contacts").Select(ActorPath.Parse).ToImmutableSortedSet(); TimeSpan? reconnectTimeout = config.GetString("reconnect-timeout").Equals("off") ? null : (TimeSpan?)config.GetTimeSpan("reconnect-timeout"); return new ClusterClientSettings(initialContacts, config.GetTimeSpan("establishing-get-contacts-interval"), config.GetTimeSpan("refresh-contacts-interval"), config.GetTimeSpan("heartbeat-interval"), config.GetTimeSpan("acceptable-heartbeat-pause"), config.GetInt("buffer-size"), reconnectTimeout); }
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)); } }
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"); }
protected override Scope ParseScope(Config config) { var remote = config.GetString("remote"); //valid case for remote to be missing == null or for //remote to be nothing remote = "" if (string.IsNullOrWhiteSpace(remote)) return Deploy.NoScopeGiven; ActorPath actorPath; if(ActorPath.TryParse(remote, out actorPath)) { var address = actorPath.Address; return new RemoteScope(address); } throw new ConfigurationException(string.Format("unparseable remote node name [{0}]", "ARG0")); }
private void CreateTrayIcon(Akka.Configuration.Config config) { NotifyIcon = new System.Windows.Forms.NotifyIcon { Icon = BLUECATS.ToastNotifier.Properties.Resources.favicon, Text = "BLUE CATS Client" }; var menu = new System.Windows.Forms.ContextMenu(); NotifyIcon.ContextMenu = menu; NotifyIcon.Visible = true; var authority = AkkaHelper.ReadConfigurationFromHoconFile(Assembly.GetExecutingAssembly(), "conf") .WithFallback(ConfigurationFactory .FromResource <ConsumerSettings <object, object> >("Akka.Streams.Kafka.reference.conf")) .GetInt("ui.notification.authority-level"); menu.MenuItems.Add($"{_version} [{authority}]").Enabled = false; menu.MenuItems.Add(new System.Windows.Forms.MenuItem(@"&BLUE CATS", onClick: (_, __) => { var url = config.GetString("ui.server.url"); System.Diagnostics.Process.Start(url); })); menu.MenuItems.Add("-"); menu.MenuItems.Add(new System.Windows.Forms.MenuItem(@"&All Clear", onClick: (_, __) => { //notificationActor.Tell(new ClearAll()); Notifier.ClearMessages(new ClearAll()); })); menu.MenuItems.Add(new System.Windows.Forms.MenuItem(@"&Exit", onClick: (_, __) => { NotifyIcon.Visible = false; Shutdown(); })); }