本文整理汇总了C#中Akka.Configuration.Config.WithFallback方法的典型用法代码示例。如果您正苦于以下问题:C# Config.WithFallback方法的具体用法?C# Config.WithFallback怎么用?C# Config.WithFallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Configuration.Config
的用法示例。
在下文中一共展示了Config.WithFallback方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateClient
private static ActorSystem CreateClient(Config commonConfig)
{
var config = commonConfig.WithFallback("akka.remote.helios.tcp.port = 9002");
var system = ActorSystem.Create("Client", config);
DeadRequestProcessingActor.Install(system);
return system;
}
示例2: ParseConfig
public virtual Deploy ParseConfig(string key, Config config)
{
var deployment = config.WithFallback(_default);
var routerType = deployment.GetString("router");
var router = CreateRouterConfig(routerType, deployment);
var dispatcher = deployment.GetString("dispatcher");
var mailbox = deployment.GetString("mailbox");
var deploy = new Deploy(key, deployment, router, Deploy.NoScopeGiven, dispatcher, mailbox);
return deploy;
}
示例3: SqliteJournal
public SqliteJournal(Config journalConfig) : base(journalConfig.WithFallback(Extension.DefaultJournalConfig))
{
var config = journalConfig.WithFallback(Extension.DefaultJournalConfig);
QueryExecutor = new SqliteQueryExecutor(new QueryConfiguration(
schemaName: null,
journalEventsTableName: config.GetString("table-name"),
metaTableName: config.GetString("metadata-table-name"),
persistenceIdColumnName: "persistence_id",
sequenceNrColumnName: "sequence_nr",
payloadColumnName: "payload",
manifestColumnName: "manifest",
timestampColumnName: "timestamp",
isDeletedColumnName: "is_deleted",
tagsColumnName: "tags",
orderingColumnName: "ordering",
timeout: config.GetTimeSpan("connection-timeout")),
Context.System.Serialization,
GetTimestampProvider(config.GetString("timestamp-provider")));
}
示例4: SqliteSnapshotStore
public SqliteSnapshotStore(Config snapshotConfig) : base(snapshotConfig)
{
var config = snapshotConfig.WithFallback(Extension.DefaultSnapshotConfig);
QueryExecutor = new SqliteSnapshotQueryExecutor(new QueryConfiguration(
schemaName: null,
snapshotTableName: "snapshot",
persistenceIdColumnName: "persistence_id",
sequenceNrColumnName: "sequence_nr",
payloadColumnName: "payload",
manifestColumnName: "manifest",
timestampColumnName: "created_at",
timeout: config.GetTimeSpan("connection-timeout")),
Context.System.Serialization);
}
示例5: Settings
/// <summary>
/// Initializes a new instance of the <see cref="Settings" /> class.
/// </summary>
/// <param name="system">The system.</param>
/// <param name="config">The configuration.</param>
public Settings(ActorSystem system, Config config)
{
Config fallback = ConfigurationFactory.Default();
Config merged = config == null ? fallback : config.WithFallback(fallback);
System = system;
Config = merged;
ConfigVersion = Config.GetString("akka.version");
ProviderClass = Config.GetString("akka.actor.provider");
var providerType = Type.GetType(ProviderClass);
if (providerType == null)
throw new ConfigurationException(string.Format("'akka.actor.provider' is not a valid type name : '{0}'", ProviderClass));
if (!typeof(ActorRefProvider).IsAssignableFrom(providerType))
throw new ConfigurationException(string.Format("'akka.actor.provider' is not a valid actor ref provider: '{0}'", ProviderClass));
SupervisorStrategyClass = Config.GetString("akka.actor.guardian-supervisor-strategy");
CreationTimeout = Config.GetMillisDuration("akka.actor.creation-timeout");
UnstartedPushTimeout = Config.GetMillisDuration("akka.actor.unstarted-push-timeout");
SerializeAllMessages = Config.GetBoolean("akka.actor.serialize-messages");
SerializeAllCreators = Config.GetBoolean("akka.actor.serialize-creators");
LogLevel = Config.GetString("akka.loglevel");
StdoutLogLevel = Config.GetString("akka.stdout-loglevel");
Loggers = Config.GetStringList("akka.loggers");
LoggerStartTimeout = Config.GetMillisDuration("akka.logger-startup-timeout");
//handled
LogConfigOnStart = Config.GetBoolean("akka.log-config-on-start");
LogDeadLetters = 0;
switch (Config.GetString("akka.log-dead-letters"))
{
case "on":
case "true":
LogDeadLetters = int.MaxValue;
break;
case "off":
case "false":
LogDeadLetters = 0;
break;
default:
LogDeadLetters = Config.GetInt("akka.log-dead-letters");
break;
}
LogDeadLettersDuringShutdown = Config.GetBoolean("akka.log-dead-letters-during-shutdown");
AddLoggingReceive = Config.GetBoolean("akka.actor.debug.receive");
DebugAutoReceive = Config.GetBoolean("akka.actor.debug.autoreceive");
DebugLifecycle = Config.GetBoolean("akka.actor.debug.lifecycle");
DebugEventStream = Config.GetBoolean("akka.actor.debug.event-stream");
DebugUnhandledMessage = Config.GetBoolean("akka.actor.debug.unhandled");
DebugRouterMisConfiguration = Config.GetBoolean("akka.actor.debug.router-misconfiguration");
Home = Config.GetString("akka.home") ?? "";
//TODO: dunno.. we dont have FiniteStateMachines, dont know what the rest is
/*
final val FsmDebugEvent: Boolean = getBoolean("akka.actor.debug.fsm")
final val SchedulerClass: String = getString("akka.scheduler.implementation")
final val Daemonicity: Boolean = getBoolean("akka.daemonic")
final val DefaultVirtualNodesFactor: Int = getInt("akka.actor.deployment.default.virtual-nodes-factor")
*/
}
示例6: ClusterSpecBase
protected ClusterSpecBase(Config config) : base(config.WithFallback(BaseConfig))
{
}
示例7: CreateClusterNode
private static void CreateClusterNode(Config commonConfig, int port, params string[] roles)
{
var config = commonConfig
.WithFallback("akka.remote.helios.tcp.port = " + port)
.WithFallback("akka.cluster.roles = " + "[" + string.Join(",", roles) + "]");
var system = ActorSystem.Create("BasicCluster", config);
var cluster = Cluster.Get(system);
var clusterNode = new ClusterNode
{
Context = new ClusterNodeContext
{
System = system,
ClusterActorDiscovery = system.ActorOf(Props.Create(() => new ClusterActorDiscovery(cluster)),
"cluster_actor_discovery")
},
Roles = roles
};
InitClusterNode(clusterNode);
_clusterNodes.Add(clusterNode);
}
示例8: ParseConfig
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(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;
}
}