These are chat archives for akkadotnet/akka.net

5th
Feb 2018
Vasily Kirichenko
@vasily-kirichenko
Feb 05 2018 08:08
@Horusiath a node in my consul-based cluster disappeared again, after several days of work. Restarting the node solves it. Unfortunately, consul logs was not configured properly, so there are no ones.
Arjen Smits
@Danthar
Feb 05 2018 08:19
@mmisztal1980 its being worked on.
@OnurGumus what do you mean exactly with "It doesn't make the child a real child" ?
Bartosz Sypytkowski
@Horusiath
Feb 05 2018 09:43
@vasily-kirichenko do you have any logs on the akka side? I'm suspecting, that long-running connections inside consul .net clients may be failing. Maybe some kind of retry mechanics or periodic connection reset is necessary.
Onur Gumus
@OnurGumus
Feb 05 2018 09:56
@Danthar I mean that prob's parent is not that parent.
Just because you passed a test prob to a parent, doesn't make parent its own supervisor.
So it is wrong in that sense. You are not really mocking a child actor.
In other words, if I ask to parent, tell me who are your children, it will not know about the test probe that's passed.
Arjen Smits
@Danthar
Feb 05 2018 10:09
uh
yes you do
prop is just a description of an actor
Onur Gumus
@OnurGumus
Feb 05 2018 10:10
no no
Arjen Smits
@Danthar
Feb 05 2018 10:10
if you pass props to another actor, and have that actor instantiate it as a child actor
then it becomes its child actor
Onur Gumus
@OnurGumus
Feb 05 2018 10:10
it's not prop , it is probe
Func<IUntypedActorContext, IActorRef> maker = (ctx) => probe.Ref;
look at this line.
you are just returning probe's reference as a child.
But that child is not actual child of parent.
Arjen Smits
@Danthar
Feb 05 2018 10:11
ah yes, in a test case yes
it allows you to take control of the behavior of child in test cases
Onur Gumus
@OnurGumus
Feb 05 2018 10:12
There is no way to specify a probe's parent.
Arjen Smits
@Danthar
Feb 05 2018 10:12
yes, but that is not the point here
the point is, that passing props, or passing a Func
allows you when writing tests
to hook into that
Onur Gumus
@OnurGumus
Feb 05 2018 10:13
Yes but for me this is not adequate.
Arjen Smits
@Danthar
Feb 05 2018 10:13
and test the intended behavior between the parent actor and the child its using
ok, what do you want to test then ?
Onur Gumus
@OnurGumus
Feb 05 2018 10:13
I have a test case to check how many children is created based on the factory passed.
Normally I was sending "Parent/*" an Identify message
since there is no real relation between probe and parent, that request doesn't work.
Arjen Smits
@Danthar
Feb 05 2018 10:14
ok, well in that case, why use the probe ?
Onur Gumus
@OnurGumus
Feb 05 2018 10:14
Because I don't want to use the real child actor for obvious reasons.
Arjen Smits
@Danthar
Feb 05 2018 10:15
ok, can you replace the props object that the parent actor is using to instantiate its children
Onur Gumus
@OnurGumus
Feb 05 2018 10:15
I only want to test if parent is creating its children correctly
hmm
Arjen Smits
@Danthar
Feb 05 2018 10:16
simply have your factory return real actors props which are used as children
but use a specialized test actor for that
Func<IUntypedActorContext, IActorRef> maker = (ctx) => ctx.ActorOf(Props.Create<Child>())
If your using that. There is a DSL like syntax available. That allows you to define the actor type inline
So you can do something like ctx.ActorOf( DSL HERE )
Onur Gumus
@OnurGumus
Feb 05 2018 10:19
Yes, I actually found a different work around
Arjen Smits
@Danthar
Feb 05 2018 10:19
ok
Onur Gumus
@OnurGumus
Feb 05 2018 10:19
base.ActorOfAsTestActorRef<CustomTestProbe>
                        (supervisor: s.GetArgument<IActorContext>(1).Self, name: s.GetArgument<string>(0));
I have created a custom test probe class and ActorAsTestActorRef allows me to specify the supervisor
In all cases my initial statement holds, that example documented is not a correct way to truly create a parent child relation.
Arjen Smits
@Danthar
Feb 05 2018 10:21
that is true. But thats also not what that testcase is about
Onur Gumus
@OnurGumus
Feb 05 2018 10:21
Maybe
Arjen Smits
@Danthar
Feb 05 2018 10:21
its about externalising how you create your child actor, in such a way that you can hook into that for testing purposes
Onur Gumus
@OnurGumus
Feb 05 2018 10:21
Don't you think we should have an overload for CreateTestProbe that also takes a supervisor parameter ?
Arjen Smits
@Danthar
Feb 05 2018 10:23
not sure. i'd have to take a good look at the testkit code again to form an opinion on that
Onur Gumus
@OnurGumus
Feb 05 2018 10:25

By the way for that code :

 var parent = Sys.ActorOf(Props.Create(() => new Act(actor)));

What is Act ? It is not documented any where?

For DSL usage.
Vasily Kirichenko
@vasily-kirichenko
Feb 05 2018 10:27
03.02.2018 02:51:28.308 ERROR [Akka.Cluster.Discovery.Consul.ConsulDiscoveryService,  944] - Couldn't retrieve collection of nodes from external service. Is current node unreachable? Shutting down... Consul.ConsulRequestException: Unexpected response, status code InternalServerError: rpc error making call: EOF
   at Consul.GetRequest`1.<Execute>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Akka.Cluster.Discovery.Consul.ConsulDiscoveryService.<GetNodesAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Akka.Cluster.Discovery.DiscoveryService.<ReconcileClusterStateAsync>d__19.MoveNext()
the Consul service has been running and shown in the Consul UI.
@Horusiath ^^^
Bartosz Sypytkowski
@Horusiath
Feb 05 2018 16:13
@vasily-kirichenko looks like the Consul .net plugin has fucked up :P I guess nobody tried to keep long running client implementations of it (probably most of the time it's used as transient object injected by some DI for a single request).
@mmisztal1980 I know that @Aaronontheweb is working on extracting Hocon to it's own library. Compatibility with Microsoft.Extensions.* is one of the goals for v1.4
Ismael Hamed
@ismaelhamed
Feb 05 2018 20:54
Because in Akka (JVM) a Dispatcher is also an ExecutionContext, it can be passed to Futures to execute arbitrary code. ¿Is this possible in Akka.NET at all?. I mean, replay-dispatcher seems so helpless right now.
AndreSteenbergen
@AndreSteenbergen
Feb 05 2018 23:20

Hey guys, what would be the best way to get all previous messages from a persisted actor without storing a list of all events in the actor as well. I am trying to make a pub/sub, but I would like the sub to retrieve all previous events as well (using a bool). Is it possible? Or should the sub use the PersistenceQuery instead, I am afraid I could miss messages, or get duplicates. Missing messages because getting all persisted events, read them and subscribe to actual events, with possible misses. And subscribing, and keeping events in a list before using PersistentQuery, ideally I would like somthing like the recovery method, but redirecting to the subscriber.

I hope I make some sense.