/// <summary> /// Wraps the action in an actor safe action. /// </summary> /// <param name="action">The action.</param> /// <returns>Action.</returns> private static Action WrapActionInActorSafeAction(Action action) { Action wrapped = action; if (ActorCell.Current != null) { LocalActorRef self = ActorCell.Current.Self; wrapped = () => self.Tell(new CompleteFuture(action)); } return(wrapped); }
public void Init(ActorSystemImpl system) { _system = system; //The following are the lazy val statements in Akka var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher; _defaultMailbox = () => new ConcurrentQueueMailbox(); //TODO:system.Mailboxes.FromConfig(Mailboxes.DefaultMailboxId) _rootGuardian = CreateRootGuardian(system); _tempContainer = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log); _rootGuardian.SetTempContainer(_tempContainer); _userGuardian = CreateUserGuardian(_rootGuardian, "user"); _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian); //End of lazy val _rootGuardian.Start(); // chain death watchers so that killing guardian stops the application _systemGuardian.Tell(new Watch(_userGuardian, _systemGuardian)); //Should be SendSystemMessage _rootGuardian.Tell(new Watch(_systemGuardian, _rootGuardian)); //Should be SendSystemMessage _eventStream.StartDefaultLoggers(_system); }