These are chat archives for akkadotnet/akka.net

21st
Jun 2015
Roger Johansson
@rogeralsing
Jun 21 2015 07:56
@ronnyek there is a great comparison of akka vs orleans here https://github.com/akka/akka-meta/blob/master/ComparisonWithOrleans.md
written by Roland Kuhn (jvm Akka lead) and proofread by the orelans team
Bartosz Sypytkowski
@Horusiath
Jun 21 2015 13:32
@rogeralsing what do you mean?
Roger Johansson
@rogeralsing
Jun 21 2015 14:28
In akka persistence, when a message is serialized, you set up a "Serialization.CurrentTransport=" there was some logic there to get the value to set
Thomas Tomanek
@thomastomanek
Jun 21 2015 14:43
hey all. what's the best way of testing that an actor creates another actor when handling a certain message (like creating another actor to make a web request)? I've done it so far by injecting an Expression<Func<MySubActor>> into the parent actors ctor so I can assert that the func is called, but that seems a bit roundabout. Can't find anything in TestKit that could help though...
Bartosz Sypytkowski
@Horusiath
Jun 21 2015 14:50
@sadprofessor why do you need that? It looks like an implementation detail, not a part of behavior or business logic.
Thomas Tomanek
@thomastomanek
Jun 21 2015 14:53
@Horusiath To assert that child actors are constructed with the correct params. The parent actors sole job is to create business entities on the fly so I wanted tests to make sure they're a) actually being created when necessary, b) being created with the correct params, c) not being recreated if they already exist
@Horusiath happy to consider an alternative though, quite new to actor design
Thomas Tomanek
@thomastomanek
Jun 21 2015 14:58
@Aaronontheweb yes familiar, but I can't remember where from. I feel like Greg Young has spoken about it and/or Chris Patterson (MassTransit dude) but can't find any links
Bartosz Sypytkowski
@Horusiath
Jun 21 2015 15:26
@sadprofessor IMO, it's good to treat actors as black boxes. In example given input signals passed to actor X, verify the expected output signals have been sent
if your actor system responds with expected result on given request, then how it's implemented is a secondary matter
Bartosz Sypytkowski
@Horusiath
Jun 21 2015 15:32
this way, you can still reimplement it without need to changing the tests
Thomas Tomanek
@thomastomanek
Jun 21 2015 16:12
@Horusiath yep totally agree with you in general, but in this case the actor doesn't really have any output in terms of messages but you'd still want to verify it's doing what you want (given it's importance). I agree it's best to avoid peering into any classes internal state to validate behavior, but then again it's a rule I break on occasion when necessary
Thomas Tomanek
@thomastomanek
Jun 21 2015 16:19
maybe I've missed a concept and have this one master actor doing too much and should get it to send out messages to create the domain objects
Roger Johansson
@rogeralsing
Jun 21 2015 17:02
You can do state testing using .TestActorOf then you have access to the ubderlaying actor and its public members
So you could potentially check if the actor has a new child
Using testkit that is
Thomas Tomanek
@thomastomanek
Jun 21 2015 17:19
@rogeralsing ah cool I'll take a look thanks
Roger Johansson
@rogeralsing
Jun 21 2015 17:21
Using TestActorOf is a little bit different than what we are used to with actors, it will apply a synchronous dispatcher so all Tells are sync/blocking so that you can do state observations... so there are essentially two flavors of testabillity in TestKit, either with messages and Expect* or sync state testing using TestActorOf
Roger Johansson
@rogeralsing
Jun 21 2015 17:48
ActorOfAsTestActorRef is the correct method name
in TestKitBase
NeoDarque
@NeoDarque
Jun 21 2015 21:36
I’m playing around with Akka.Cluster and have managed to get a cluster router up and running which I can use to send messages to the relevant nodes when they join the cluster. However, I’ve got the configuration of the router working in code only and would like to move it to the hocon-config file. How would I translate the following code to config?
system.ActorOf(Props.Empty.WithRouter(
    new ClusterRouterGroup(
        new RoundRobinGroup("/user/backend"),
        new ClusterRouterGroupSettings(10, false, "backend", ImmutableHashSet.Create("/user/backend"))
    )
));