当前位置: 首页>>代码示例>>C#>>正文


C# ActorSystem.AsInstanceOf方法代码示例

本文整理汇总了C#中ActorSystem.AsInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:C# ActorSystem.AsInstanceOf方法的具体用法?C# ActorSystem.AsInstanceOf怎么用?C# ActorSystem.AsInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActorSystem的用法示例。


在下文中一共展示了ActorSystem.AsInstanceOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoteDeploySpec

        public RemoteDeploySpec()
            : base(@"
            akka {
                loglevel = INFO 
                log-dead-letters-during-shutdown = false
              //  actor.provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                remote.helios.tcp = {
                    hostname = localhost
                    port = 0
                }

                actor.deployment {
                  /router1 {
                    router = round-robin-pool
                    nr-of-instances = 3
                  }
                  /router2 {
                    router = round-robin-pool
                    nr-of-instances = 3
                  }
                  /router3 {
                    router = round-robin-pool
                    nr-of-instances = 0
                  }
                }
            }
")
        {
            _remoteSystem = ActorSystem.Create("RemoteSystem", Sys.Settings.Config);
            _remoteAddress = _remoteSystem.AsInstanceOf<ExtendedActorSystem>().Provider.DefaultAddress;
            var remoteAddressUid = AddressUidExtension.Uid(_remoteSystem);


        }
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:34,代码来源:RemoteDeploySpec.cs

示例2: ConsistentHashingRoutingLogic

 /// <summary>
 /// Initializes a new instance of the <see cref="ConsistentHashingRoutingLogic"/> class.
 /// </summary>
 /// <param name="system">The actor system that owns the router with this logic.</param>
 /// <param name="virtualNodesFactor">The number of virtual nodes to use on the hash ring.</param>
 /// <param name="hashMapping">The consistent hash mapping function to use on incoming messages.</param>
 public ConsistentHashingRoutingLogic(ActorSystem system, int virtualNodesFactor,
     ConsistentHashMapping hashMapping)
 {
     _system = system;
     _log = new Lazy<ILoggingAdapter>(() => Logging.GetLogger(_system, this), true);
     _hashMapping = hashMapping;
     _selfAddress = system.AsInstanceOf<ExtendedActorSystem>().Provider.DefaultAddress;
     _vnodes = virtualNodesFactor == 0 ? system.Settings.DefaultVirtualNodesFactor : virtualNodesFactor;
 }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:15,代码来源:ConsistentHashRouter.cs

示例3: MultiNodeSpec

        protected MultiNodeSpec(
            RoleName myself,
            ActorSystem system,
            ImmutableList<RoleName> roles,
            Func<RoleName, ImmutableList<string>> deployments)
            : base(new XunitAssertions(), system)
        {
            _myself = myself;
            _log = Logging.GetLogger(Sys, this);
            _roles = roles;
            _deployments = deployments;
            var node = new IPEndPoint(Dns.GetHostAddresses(ServerName)[0], ServerPort);
            _controllerAddr = node;

            AttachConductor(new TestConductor(system));

            _replacements = _roles.ToImmutableDictionary(r => r, r => new Replacement("@" + r.Name + "@", r, this));

            InjectDeployments(system, myself);

            _myAddress = system.AsInstanceOf<ExtendedActorSystem>().Provider.DefaultAddress;

            Log.Info("Role [{0}] started with address [{1}]", myself.Name, _myAddress);
            MultiNodeSpecBeforeAll();
        }
开发者ID:rogeralsing,项目名称:akka.net,代码行数:25,代码来源:MultiNodeSpec.cs

示例4: InjectDeployments

 protected void InjectDeployments(ActorSystem system, RoleName role)
 {
     var deployer = system.AsInstanceOf<ExtendedActorSystem>().Provider.Deployer;
     foreach (var str in _deployments(role))
     {
         var deployString = _replacements.Values.Aggregate(str, (@base, r) =>
         {
             var indexOf = @base.IndexOf(r.Tag, StringComparison.Ordinal);
             if (indexOf == -1) return @base;
             string replaceWith;
             try
             {
                 replaceWith = r.Addr;
             }
             catch (Exception e)
             {
                 // might happen if all test cases are ignored (excluded) and
                 // controller node is finished/exited before r.addr is run
                 // on the other nodes
                 var unresolved = "akka://unresolved-replacement-" + r.Role.Name;
                 Log.Warning(unresolved + " due to: {0}", e.ToString());
                 replaceWith = unresolved;
             }
             return @base.Replace(r.Tag, replaceWith);
         });
         foreach (var pair in ConfigurationFactory.ParseString(deployString).AsEnumerable())
         {
             if (pair.Value.IsObject())
             {
                 var deploy =
                     deployer.ParseConfig(pair.Key, new Config(new HoconRoot(pair.Value)));
                 deployer.SetDeploy(deploy);
             }
             else
             {
                 throw new ArgumentException(String.Format("key {0} must map to deployment section, not simple value {1}",
                     pair.Key, pair.Value));
             }
         }
     }
 }
开发者ID:Micha-kun,项目名称:akka.net,代码行数:41,代码来源:MultiNodeSpec.cs


注:本文中的ActorSystem.AsInstanceOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。