internal ActorSystem(string name, ActorsConfiguration?config) { Config = config ?? ActorsConfiguration.CreateDefault(); Name = ActorPath.Sanitize(name); Location = new ActorPath($"{ActorPath.ProtocolName}://{Name}/"); Actors = new Dictionary <ActorPath, ActorContainer>(); CancelToken = new CancellationTokenSource(); Scheduler = new Scheduler(); Scheduler.AssignSystem(this); Root = new RootSupervisor(this); Root.Populate(this, ActorReferences.Nobody, Location); var rootcontainer = new ActorContainer(new ActorSchematic(() => new RootSupervisor(this)), Location.Name, Root); Actors.Add(Location, rootcontainer); Root.CallOnCreate(); Log = new ActorLogger(Root); Lost = new LostLetters(this); Lost.Populate(this, new LocalActorReference(this, Root.Path), new ActorPath(Location.Path, "lost-letters")); var lostcontainer = new ActorContainer(new ActorSchematic(() => new LostLetters(this)), "lost-letters", Lost); Actors.Add(Lost.Path, lostcontainer); Lost.CallOnCreate(); if (!Config.ManuallyStartScheduler) { Scheduler.Start(); } SystemCount++; }
internal static ActorsConfiguration CreateDefault() { var config = new ActorsConfiguration { }; return(config); }
public static ActorSystem Create(string name, ActorsConfiguration config) { return(new ActorSystem(name, config)); }