示例#1
0
        /// <summary>
        /// Parses hocon configuration of actor system and starts <seealso cref="NameSpaceActor"/> that was defined in it
        /// </summary>
        /// <param name="sys">The actor system</param>
        public static void StartNameSpaceActorsFromConfiguration(this ActorSystem sys)
        {
            var config = sys.Settings.Config.GetConfig("akka.actor.deployment");
            if (config == null)
            {
                return;
            }

            foreach (var pair in config.AsEnumerable())
            {
                var key = pair.Key;
                var path = key.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                if (path.Length != 1)
                {
                    continue;
                }

                var isNameSpace = config.GetConfig(key).GetBoolean("IsNameSpace");
                if (isNameSpace)
                {
                    sys.ActorOf(sys.DI().Props(typeof(NameSpaceActor)), path[0]);
                    sys.Log.Info(
                        "{Type}: starting namespace {NameSpaceName}",
                        typeof(ActorSystemUtils).Name,
                        path[0]);
                }
            }
        }
示例#2
0
        public static IActorRef SignalHub(this ActorSystem system)
        {
            if (Nobody.Instance.Equals(_hub))
                _hub = system.ActorOf<HubManager>(HubManager.Name);

            return _hub;
        }
示例#3
0
        public static IActorRef SignalClient(this ActorSystem system)
        {
            if (Equals(_clientManager, Nobody.Instance))
                _clientManager = system.ActorOf<ClientManager>(ClientManager.Name);

            return _clientManager;
        }
示例#4
0
 public static IActorRef CreateTestActor(this ActorSystem system, ActorProps actorToBeTested)
 {
     return system.ActorOf(ActorProps.Create<TestManagerActor>(actorToBeTested));
 }