public CustomUntypedActor() { var actorName = Self.Path.Name; // ColoredConsole.WriteCreationEvent($" [{actorName}] CREATING '{actorName}' actor with address '{Self.Path.ToString()}'."); ColoredConsole.WriteCreationEvent($" [{actorName}] Path: '{Self.Path.ToString()}', UID: '{Self.Path.Uid}', Address: '{Self.Path.Address}', Parent: '{Self.Path.Parent}', Root: '{Self.Path.Root}'."); }
public PlaybackStatisticsActor() : base() { ColoredConsole.WriteCreationEvent($" [{this.ActorName}] '{ActorName}' actor constructor."); _moviePlayCounterActor = Context.ActorOf(MoviePlayCounterActor.Props(), ActorPaths.MoviePlayCounterActor.Name); }
public CustomReceiveActor() { _actorName = Self.Path.Name; // ColoredConsole.WriteCreationEvent($" [{_actorName}] CREATED '{_actorName}' actor with address '{Self.Path.ToString()}'."); ColoredConsole.WriteCreationEvent($" [{_actorName}] Name: '{Self.Path.Name}', '{Self.Path.Uid}', '{Self.Path.Address}', '{Self.Path.Parent}', '{Self.Path.Root}'."); }
public MoviePlaybackActor() : base() { ColoredConsole.WriteCreationEvent($" [{this.ActorName}] '{ActorName}' actor constructor."); UserCoordinatorActorRef = ActorSystemHelper.CreateActorHelper(Context, UserCoordinatorActor.Props(), ActorPaths.UserCoordinatorActor.Name); PlaybackStatisticsActorRef = ActorSystemHelper.CreateActorHelper(Context, PlaybackStatisticsActor.Props(), ActorPaths.PlaybackStatisticsActor.Name); }
public static IActorRef CreateActorHelper(IUntypedActorContext context, Props props, string actorName) { IActorRef actorRef = context.ActorOf(props, actorName); ColoredConsole.WriteCreationEvent($"CREATED '{actorName}' actor."); return(actorRef); }
public static IActorRef CreateActorHelper(Props props, string actorName) { IActorRef actorRef = GetAkkaActorSystem().ActorOf(props, actorName); ColoredConsole.WriteCreationEvent($"CREATED '{actorName}' actor."); return(actorRef); }
public UserActor(int userId) { ColoredConsole.WriteCreationEvent($" [{this.ActorName}] '{ActorName}' actor constructor."); _userId = userId; _currentlyPlaying = null; // Initial behavior Become(StoppedBehavior); }
public static void TerminateActorSystem() { // Notify ActorSystem (and all child actors) to temrinate ColoredConsole.WriteCreationEvent($"TERMINATING '{GetAkkaActorSystem().Name}' ActorSystem."); AkkaActorSystem.Terminate(); // Wait for ActorSystem to finish shutting down Task whenTerminatedTask = AkkaActorSystem.WhenTerminated; whenTerminatedTask.Wait(); AkkaActorSystem = null; }
public static void CreateActorSystem(string actorSystemName) { // Read Akka configuration and create an ActionSystem Config config = HoconConfiguration.ReadAndParse(Constants.AkkaConfigurationFileName); ColoredConsole.WriteTitle($"Application Name: {config.GetString("application.info.name")}"); if (AkkaActorSystem == null) { AkkaActorSystem = ActorSystem.Create(actorSystemName, config); ColoredConsole.WriteCreationEvent($"CREATED '{actorSystemName}' ActorSystem."); } var petabridgeCmdHost = PetabridgeCmd.Get(GetAkkaActorSystem()); petabridgeCmdHost.RegisterCommandPalette(Petabridge.Cmd.Remote.RemoteCommands.Instance); petabridgeCmdHost.Start(); }
private IActorRef CreateOrGetChildActor(int userId) { IActorRef actorRef; var childActorMetaData = ActorPaths.GetUserActorMetaData(userId.ToString()); // ColoredConsole.WriteTemporaryDebugMessage($"User Actor Path: '{userActorMetaData.Path}'"); // Use ResolveOne or Identity message to get the Actor Reference // actorRef = _actorSystemHelper.GetActorRefUsingIdentity(userActorMetaData.Path); actorRef = ActorSystemHelper.GetActorRefUsingResolveOne(childActorMetaData.Path); if (actorRef == null) { actorRef = ActorSystemHelper.CreateActor(Context, UserActor.Props(userId), childActorMetaData.Name); ColoredConsole.WriteCreationEvent($" [{this.ActorName}] '{this.ActorName}' has created new child '{childActorMetaData.Name}' actor for UserId {userId}."); } return(actorRef); }
public MoviePlayCounterActor() : base() { ColoredConsole.WriteCreationEvent($" [{this.ActorName}] '{ActorName}' actor constructor."); _moviePlayCount = new Dictionary <string, int>(); }
public UserCoordinatorActor() : base() { ColoredConsole.WriteCreationEvent($" [{this.ActorName}] '{ActorName}' actor constructor."); }