Example #1
0
 public ProfileServiceActor(IActors actors)
 {
     Receive <ReloadProfile>(msg => {
         var actor = Context.Child(msg.ProfileName);
         if (actor.IsNobody())
         {
             actor = CreateProfileActor(actors, msg.ProfileName);
         }
         actor.Tell(ProfileActor.Init.Instance);
         actor.Tell(ProfileActor.SendProfile.ToAll);
     });
     Receive <OpenProfile>(msg => {
         var actor = Context.Child(msg.ProfileName);
         if (actor.IsNobody())
         {
             actor = CreateProfileActor(actors, msg.ProfileName);
         }
         ProfileListeners[msg.ConnectionId] = msg.ProfileName;
         actor.Tell(new ProfileActor.SendProfile(msg.ConnectionId));
     });
     Receive <TryStopProfile>(msg => {
         var profileName = msg.ProfileName;
         if (!ProfileListeners.Values.Any(v => profileName.Equals(v, StringComparison.OrdinalIgnoreCase)))
         {
             var actor = Context.Child(profileName);
             Context.Stop(actor);
         }
     });
     Receive <CloseProfile>(msg => {
         if (!ProfileListeners.TryGetValue(msg.ConnectionId, out var profileName))
         {
             return;
         }
         ProfileListeners.Remove(msg.ConnectionId);
         var timeout = TimeSpan.FromMinutes(2);
         Context.System.Scheduler.ScheduleTellOnce(timeout, Self,
                                                   new TryStopProfile(profileName), Self);
     });
 }
Example #2
0
        public EventConsumersController(IEventConsumerInfoRepository eventConsumerRepository, IActors actors)
        {
            this.eventConsumerRepository = eventConsumerRepository;

            this.actors = actors;
        }
Example #3
0
 private static IActorRef CreateProfileActor(IActors actors, string profileName)
 {
     return(Context.ActorOf(Props.Create <ProfileActor>(profileName, actors.ProfileNotifier), profileName));
 }
Example #4
0
 public ProfilesController(ConfigDbContext dbContext, IActors actors)
     : base(dbContext)
 {
     _actors = actors;
 }
Example #5
0
 public ProfileHub(IActors actors)
 {
     _actors = actors;
 }