These are chat archives for petabridge/akka-bootcamp

24th
Sep 2015
mph911
@mph911
Sep 24 2015 20:41
hi there, I just started to do the boot camp and stumbled over something I wondered.
jweimann
@jweimann
Sep 24 2015 20:42
hi
mph911
@mph911
Sep 24 2015 20:47
the following code snipped looks wired to me
~_coordinator =
Context.ActorOf (Props.Empty.WithRouter (new BroadcastGroup (ActorPaths.GithubCoordinatorActor.Path + "1",
ActorPaths.GithubCoordinatorActor.Path + "2", ActorPaths.GithubCoordinatorActor.Path + "3")));
shouldn't or better couldn't it be replaced by something along those lines (for readability :-))
~

_coordinator =
Context.ActorOf (Props.Empty.WithRouter (new BroadcastGroup (c1.Path.ToStringWithAddress (), c2.Path.ToStringWithAddress (), c3.Path.ToStringWithAddress ())));
Sorry for poor formatting still trying to get the use of this chat client
jweimann
@jweimann
Sep 24 2015 20:49
@Aaronontheweb can correct me, but I believe that's just creating a broadcast router that will message those other 3 actors whenever you .tell it. So instead of doing c1.Tell(message), c2.Tell(message), etc, you just do a .Tell to that one and it'll send to all of them.
think it's just trying to explain in a simple example how you'd use a broadcast router
maybe not super useful if you only have 3 hard coded actors to msg, but in a situation where you have a big or changing collection of them, it simplifies your code and probably does some magic underneath to make it faster too
mph911
@mph911
Sep 24 2015 20:51
Yes, that I understood. But my question is 'Can I get rid of those magic numbers in the contrutor call by using the ToStringWithAddress() method?'
jweimann
@jweimann
Sep 24 2015 20:54
yea, if I'm understanding right that seems fine. was the top the sample? if so it could just be written like that to keep it simple looking.
mph911
@mph911
Sep 24 2015 20:56
Thank you - that's what I thought too and yes the falsely and irritating misformatted strike-out part was taken from the bootcamp source code.
Aaron Stannard
@Aaronontheweb
Sep 24 2015 22:09
@bobbychopra just reviewed F# Unit 1 - it looks great! Just fix those issues with broken images and I'll merge the pull request
nice job