public LocalActorRefProvider(string systemName, Settings settings, EventStream eventStream, Deployer deployer, Func<ActorPath, InternalActorRef> deadLettersFactory) { _settings = settings; _eventStream = eventStream; _deployer = deployer ?? new Deployer(settings); _rootPath = new RootActorPath(new Address("akka", systemName)); _log = Logging.GetLogger(eventStream, "LocalActorRefProvider(" + _rootPath.Address + ")"); if (deadLettersFactory == null) deadLettersFactory = p => new DeadLetterActorRef(this, p, _eventStream); _deadLetters = deadLettersFactory(_rootPath / "deadLetters"); _tempNumber = new AtomicCounterLong(1); _tempNode = _rootPath / "temp"; //TODO: _guardianSupervisorStrategyConfigurator = dynamicAccess.createInstanceFor[SupervisorStrategyConfigurator](settings.SupervisorStrategyClass, EmptyImmutableSeq).get _systemGuardianStrategy = SupervisorStrategy.DefaultStrategy; }
public LocalActorRefProvider(string systemName, Settings settings, EventStream eventStream, Deployer deployer, Func <ActorPath, InternalActorRef> deadLettersFactory) { _settings = settings; _eventStream = eventStream; _deployer = deployer ?? new Deployer(settings); _rootPath = new RootActorPath(new Address("akka", systemName)); _log = Logging.GetLogger(eventStream, "LocalActorRefProvider(" + _rootPath.Address + ")"); if (deadLettersFactory == null) { deadLettersFactory = p => new DeadLetterActorRef(this, p, _eventStream); } _deadLetters = deadLettersFactory(_rootPath / "deadLetters"); _tempNumber = new AtomicCounterLong(1); _tempNode = _rootPath / "temp"; //TODO: _guardianSupervisorStrategyConfigurator = dynamicAccess.createInstanceFor[SupervisorStrategyConfigurator](settings.SupervisorStrategyClass, EmptyImmutableSeq).get _systemGuardianStrategy = SupervisorStrategy.DefaultStrategy; }
/// <summary> /// TBD /// </summary> /// <param name="systemName">TBD</param> /// <param name="settings">TBD</param> /// <param name="eventStream">TBD</param> /// <param name="deployer">TBD</param> /// <param name="deadLettersFactory">TBD</param> public LocalActorRefProvider(string systemName, Settings settings, EventStream eventStream, Deployer deployer, Func <ActorPath, IInternalActorRef> deadLettersFactory) { _settings = settings; _eventStream = eventStream; _deployer = deployer ?? new Deployer(settings); _rootPath = new RootActorPath(new Address("akka", systemName)); _log = Logging.GetLogger(eventStream, "LocalActorRefProvider(" + _rootPath.Address + ")"); if (deadLettersFactory == null) { deadLettersFactory = p => new DeadLetterActorRef(this, p, _eventStream); } _deadLetters = deadLettersFactory(_rootPath / "deadLetters"); IgnoreRef = new IgnoreActorRef(this); _tempNumber = new AtomicCounterLong(1); _tempNode = _rootPath / "temp"; _systemGuardianStrategy = SupervisorStrategy.DefaultStrategy; _userGuardianStrategyConfigurator = SupervisorStrategyConfigurator.CreateConfigurator(Settings.SupervisorStrategyClass); }
public override void Init() { Deployer = new Deployer(System.Settings); base.Init(); }
public LocalActorRefProvider(string systemName, Settings settings, EventStream eventStream, Deployer deployer, Func<ActorPath, IInternalActorRef> deadLettersFactory) { _settings = settings; _eventStream = eventStream; _deployer = deployer ?? new Deployer(settings); _rootPath = new RootActorPath(new Address("akka", systemName)); _log = Logging.GetLogger(eventStream, "LocalActorRefProvider(" + _rootPath.Address + ")"); if(deadLettersFactory == null) deadLettersFactory = p => new DeadLetterActorRef(this, p, _eventStream); _deadLetters = deadLettersFactory(_rootPath / "deadLetters"); _tempNumber = new AtomicCounterLong(1); _tempNode = _rootPath / "temp"; _systemGuardianStrategy = SupervisorStrategy.DefaultStrategy; _userGuardianStrategyConfigurator = SupervisorStrategyConfigurator.CreateConfigurator(Settings.SupervisorStrategyClass); }
public IInternalActorRef ActorOf(ActorSystemImpl system, Props props, IInternalActorRef supervisor, ActorPath path, bool systemService, Deploy deploy, bool lookupDeploy, bool async) { if (props.Deploy.RouterConfig is NoRouter) { if (Settings.DebugRouterMisconfiguration) { var d = Deployer.Lookup(path); if (d != null && !(d.RouterConfig is NoRouter)) { Log.Warning("Configuration says that [{0}] should be a router, but code disagrees. Remove the config or add a RouterConfig to its Props.", path); } } var props2 = props; // mailbox and dispatcher defined in deploy should override props var propsDeploy = lookupDeploy ? Deployer.Lookup(path) : deploy; if (propsDeploy != null) { if (propsDeploy.Mailbox != Deploy.NoMailboxGiven) { props2 = props2.WithMailbox(propsDeploy.Mailbox); } if (propsDeploy.Dispatcher != Deploy.NoDispatcherGiven) { props2 = props2.WithDispatcher(propsDeploy.Dispatcher); } } if (!system.Dispatchers.HasDispatcher(props2.Dispatcher)) { throw new ConfigurationException(string.Format("Dispatcher [{0}] not configured for path {1}", props2.Dispatcher, path)); } try { // for consistency we check configuration of dispatcher and mailbox locally var dispatcher = _system.Dispatchers.Lookup(props2.Dispatcher); var mailboxType = _system.Mailboxes.GetMailboxType(props2, dispatcher.Configurator.Config); if (async) { return (new RepointableActorRef(system, props2, dispatcher, mailboxType, supervisor, path).Initialize(async)); } return(new LocalActorRef(system, props2, dispatcher, mailboxType, supervisor, path)); } catch (Exception ex) { throw new ConfigurationException( string.Format( "Configuration problem while creating {0} with dispatcher [{1}] and mailbox [{2}]", path, props.Dispatcher, props.Mailbox), ex); } } else //routers!!! { var lookup = (lookupDeploy ? Deployer.Lookup(path) : null) ?? Deploy.None; var fromProps = new List <Deploy>() { props.Deploy, deploy, lookup }; var d = fromProps.Where(x => x != null).Aggregate((deploy1, deploy2) => deploy2.WithFallback(deploy1)); var p = props.WithRouter(d.RouterConfig); if (!system.Dispatchers.HasDispatcher(p.Dispatcher)) { throw new ConfigurationException(string.Format("Dispatcher [{0}] not configured for routees of path {1}", p.Dispatcher, path)); } if (!system.Dispatchers.HasDispatcher(d.RouterConfig.RouterDispatcher)) { throw new ConfigurationException(string.Format("Dispatcher [{0}] not configured for router of path {1}", p.RouterConfig.RouterDispatcher, path)); } var routerProps = Props.Empty.WithRouter(p.Deploy.RouterConfig).WithDispatcher(p.RouterConfig.RouterDispatcher); var routeeProps = props.WithRouter(NoRouter.Instance); try { var routerDispatcher = system.Dispatchers.Lookup(p.RouterConfig.RouterDispatcher); var routerMailbox = system.Mailboxes.GetMailboxType(routerProps, routerDispatcher.Configurator.Config); // routers use context.actorOf() to create the routees, which does not allow us to pass // these through, but obtain them here for early verification var routeeDispatcher = system.Dispatchers.Lookup(p.Dispatcher); var routedActorRef = new RoutedActorRef(system, routerProps, routerDispatcher, routerMailbox, routeeProps, supervisor, path); routedActorRef.Initialize(async); return(routedActorRef); } catch (Exception) { throw new ConfigurationException(string.Format("Configuration problem while creating [{0}] with router dispatcher [{1}] and mailbox {2}" + " and routee dispatcher [{3}] and mailbox [{4}].", path, routerProps.Dispatcher, routerProps.Mailbox, routeeProps.Dispatcher, routeeProps.Mailbox)); } } }