本文整理汇总了C#中Akka.Configuration.Config.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Config.GetString方法的具体用法?C# Config.GetString怎么用?C# Config.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Configuration.Config
的用法示例。
在下文中一共展示了Config.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
/// <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);
}
示例2: Create
/// <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"));
}
示例3: SessionSettings
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);
}
}
示例4: Create
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"));
}
示例5: SnapshotStoreSettings
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");
}
示例6: UserWorker
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);
}
示例7: Create
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"));
}
示例8: TcpTransport
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);
}
示例9: Create
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"));
}
示例10: ForkJoinDispatcherConfigurator
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);
}
示例11: JournalSettings
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");
}
示例12: RemoteSettings
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");
}
示例13: JournalSettings
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);
}
示例14: Configure
/// <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);
}
示例15: RemoteSettings
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");
}