These are chat archives for akkadotnet/akka.net

27th
Jun 2018
Maik Lathan
@mlathan
Jun 27 2018 11:40
Can sombody explain to me how I can disable this warning?
********|2018-06-27 13:33:10.3538|Warn|remoting|Tried to associate with unreachable remote address [akka.tcp://****@localhost:50000]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters.
Obviously it is a remoting warning. So looked it up in https://getakka.net/articles/configuration/akka.remote.html. There is a configuration key log-remote-lifecycle-events which sounds what I'm looking for to me. But setting it to error or even off has no effect. So how can I realize it?
For the context. In my system I have to seed nodes. One at localhost:50000 and the other one at localhost:50001. Sometimes it is possible by design that localhost:50000 is offline. This state will cause the warning; which is okay to me.
nathvi
@nathvi
Jun 27 2018 15:58
Is this bad design?
public void RunActorSytem()
        {
            try
            {
                var actorSystem = ActorSystem.Create("ActorSystem");
                var playerActor1 = actorSystem.ActorOf(Props.Create(() => new PlayerActor("Bob")));
                var playerActor2 = actorSystem.ActorOf(Props.Create(() => new PlayerActor("Susan")));
                var playerActor3 = actorSystem.ActorOf(Props.Create(() => new PlayerActor("Simon")));

                // All events get persisted to EventJournal Sql Server tbl.
                // When process is restarted, EventJournal replays messages to actors to restore state,
                // BEFORE messages from mailboxes can be processed.
                Task.Run(() => RunHitHealLoop(playerActor1));
                Task.Run(() => RunHitHealLoop(playerActor2));
                Task.Run(() => RunHitHealLoop(playerActor3));
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
                throw e;
            }
        }
void RunHitHealLoop(IActorRef playerActor)
        {
            while (true)
            {
                playerActor.Tell(new HitMessage(3));
                playerActor.Tell(new AddHealthMessage(10));
                playerActor.Tell(new DisplayStatusMessage());
                Thread.Sleep(3000);
            }
        }
Arjen Smits
@Danthar
Jun 27 2018 16:31
Besides that i would do a await Task.Delay instead of Thread.Sleep. There is not a whole lot to go on here.
What is your goal here ?
nathvi
@nathvi
Jun 27 2018 16:32
To spawn some threads that send messages to actors in a cycle.
Arjen Smits
@Danthar
Jun 27 2018 16:34
I get that :) But your question implies that you have some doubts concerning this particular example. Or perhaps some specific questions ?
nathvi
@nathvi
Jun 27 2018 16:35
Just curious if it makes sense to do it that way.
No particular thing.
Arjen Smits
@Danthar
Jun 27 2018 16:35
If it works for you. Sure. I wouldn't do it like this when inside another actor.
and when you start building out. You are probably going to want some kind of actor that manages PlayerActors
nathvi
@nathvi
Jun 27 2018 16:36
A "PlayerManagerActor"
or a "PlayerGodActor"
Arjen Smits
@Danthar
Jun 27 2018 16:37
depends on what problem your solving
usually your system has more then just players
so there comes a point where you will want to fetch an IActorRef to a certain playerActor
Thats where something like the PlayerManagerActor comes into play
nathvi
@nathvi
Jun 27 2018 16:38
hence the PlayerGodActor
Arjen Smits
@Danthar
Jun 27 2018 16:38
it would be a well known toplevel actor in your hierarchy
which the rest of your system uses to retrieve specific playeractors
and do stuff with it :)
nathvi
@nathvi
Jun 27 2018 16:38
Manager sounds like something human. Only gods can create people instantly.
Arjen Smits
@Danthar
Jun 27 2018 16:39
Naming things is one of the hardest things in our field ;)
and often subjective
nathvi
@nathvi
Jun 27 2018 16:39
true
GodOfPlayersActor?
Arjen Smits
@Danthar
Jun 27 2018 16:39
I wouldn't name it PlayerGodActor for instance. Because i would think its somekind of special PlayerActor
And it would not instantly convey "im the actor responsible for managing playeractors"
PlayerRegistryActor is also an option
nathvi
@nathvi
Jun 27 2018 16:40
That's so boring though
lol
Arjen Smits
@Danthar
Jun 27 2018 16:40
hahaha true
nathvi
@nathvi
Jun 27 2018 16:40
PlayerMasterActor
LordOfPlayerActors
Arjen Smits
@Danthar
Jun 27 2018 16:41
^^
PlayerUniverse
nathvi
@nathvi
Jun 27 2018 16:41
I would think the actor system itself would be the player universe
GrandWizardOfPlayerActors
Manager is too weak in my opinion. Managers manage existing people. They don't create them instantly or make them vanish.
Arjen Smits
@Danthar
Jun 27 2018 16:44
It can do whatever you want it to do :)
gl though ;) gtg
nathvi
@nathvi
Jun 27 2018 16:45
aiight
me-slove
@me-slove
Jun 27 2018 17:44
Like PlayerController or PlayerManager
naming over time is a critical aspect as you said @Danthar
Rodger Brennan
@rodgerbrennan
Jun 27 2018 19:50
Can actors be reparented?
nathvi
@nathvi
Jun 27 2018 20:13
Good question.
nathvi
@nathvi
Jun 27 2018 20:19
I think it makes more sense to call the child actors slave actors.