These are chat archives for petabridge/akka-bootcamp

13th
May 2016
BartekSTRX
@BartekSTRX
May 13 2016 17:04
I have a question, in Unit 2 lesson 3 there is PerformanceCounterActor, and in this actor ICancelable is used for cancelling scheduled sending of GatherMetrics messages. This object is created in construtor, and used in PreStart, PostStop methods. This means that it will be reused when actor is restarted. Is this correct/recomended usage? Wouldn't be better to create seperate ICancellable object every time actor is started?
phclem
@phclem
May 13 2016 22:40
More questions on ActorSelection. I set up a very simple Client/Server test with the Client on one process, and the Server on another (2 console apps). Using Remote, I get the ActorSelection to the server side Actor. I send a request message via the ActorSelection (which contains a DateTime timestamp of the time the message was constructed.) On the server side I log the request. On my very fast machine it took on average 660 millisecs to get that message. The I reply via the "Sender". The client side gets the reply in 60 millisecs. I conclude that the Sender as an IActorRef is able to send the message much faster than the ActorSelection. Is that an correct conclusion?
So if I need the 60 ms speed for the request side, I need to create a server "login" type message with response so on the client side I can capture the Sender as IActorRef and use that on subsequent "Tells" from the client side to the server side instead of the ActorSelection. And that should get me into the 60 ms range on the request instead of 660 ms? Does what I am suggesting for this test make sense?