These are chat archives for akkadotnet/akka.net

3rd
Aug 2015
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 04:34
@KyleGobel you probably will need to look for some examples in akka on JVM space, maybe there are some people around here, who could share some examples/thoughts of their own
Hyungho Ko
@hhko
Aug 03 2015 05:58
@hhko I want to get the example using Castle.Windsor for Akka.net?
Hyungho Ko
@hhko
Aug 03 2015 06:39
Are Parent and Child actor the same UID?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 06:48
@hhko it wouldn't be an UID, if they were the same
Hyungho Ko
@hhko
Aug 03 2015 06:52
I thought that UID is whole unique in ActorSystem. but UID can be the same different hierarchy. is it right?
Hyungho Ko
@hhko
Aug 03 2015 06:57
blob
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 06:59
ok, you're talkin about this UID ;) what do you need it for?
Hyungho Ko
@hhko
Aug 03 2015 07:04
you mean that UID of actor is not unique in ActorSystem?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 07:17
UID is only actor incarnation stamp, actor is uniquely identified by it's actor path. UID identifies specific incarnation when combined with actor path, but it's almost never used outside an akka
Hyungho Ko
@hhko
Aug 03 2015 07:40
thank you for your time and consideration ^^;
foo bar code
@lepinay
Aug 03 2015 07:41
@Horusiath Hello !, just wondering if by any chance you had time to run my gist regarding issue 999 ;)
Arjen Smits
@Danthar
Aug 03 2015 09:08
I need a persistent form of Context.System.Scheduler. Because i want registrations on the scheduler to survive process restarts. Is there anything in the akka.persistence module for this?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 09:21
@lepinay sorry, I worked on it, but didn't have enough time to figure out what was wrong
This message was deleted

@Danthar there's not such thing. @rogeralsing also was asking for that not so long ago.

I think, that the best way to do that is to create custom extension, which will run persistent schedule recorder actor when applied to actor system. From there classic event sourcing should be sufficient (just remember that schedule cancelations and ack's also may be necessary to persist)

Arjen Smits
@Danthar
Aug 03 2015 09:26
ah. Now that you quote it, i remembered that.
So basically a persistent-actor that keeps a track of a copy of the scheduler state. Towards which all scheduler messages are forwarded.
I wonder how far @rogeralsing got with his own implementation.
Roger Johansson
@rogeralsing
Aug 03 2015 09:33
I havent tried it yet, been away a while
Arjen Smits
@Danthar
Aug 03 2015 09:34
:+1:
Im still in the designing phase anyways. But its good to know i'll have to do an PoC on this in the future, and thats it not some feature i can turn off and on in the config.
Thx for the feedback
Roger Johansson
@rogeralsing
Aug 03 2015 09:59
@Danthar I dont know if you saw my response to @Horusiath on that topic, I'd like to see an api that possibly implements the same interface as the scheduler. e.g through an extension method on the actorsystem... system.PersistentScheduler that just acts as a facade over the persistent actor. not sure if it would make sense to have all the same scheduler methods, some might be impossible to use on restart, e.g. cancellation and such
but rule of least surprise and be as similar as possible would be nice
Arjen Smits
@Danthar
Aug 03 2015 10:01
Yes, that sounds like the most preferable way.
Roger Johansson
@rogeralsing
Aug 03 2015 10:49
@Horusiath is the DU stuff still bugged??
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 10:50

@rogeralsing this is from @lepinay

Hello, I've been trying to test the fix akkadotnet/akka.net#999 on the dev branch using this fsharp script https://gist.github.com/lepinay/d90c20e27e615d7f2642 , So before the fix we had a serialization exception, after the fix the exception is gone but the message is never received neither on the remote actor. Would be nice if someone could have a look at the gist before I raise a bug. I'm thinking maybe I got the hocon wrong ?

I run this on my dev version of akka, and indeed no message is received on the remote end. But I haven't got enough time to investigate it.
Roger Johansson
@rogeralsing
Aug 03 2015 13:03
found anything on the DU problems?
Stephen Collins
@nibblesnbits
Aug 03 2015 13:19
@rogeralsing, is there a mechanism in Akka.Testing.NUnit.TestKit that allows isolation of test methods? I'm getting assertion fails and errors in my tests because the Sys system is persisting across test methods.
stevemesser
@stevemesser
Aug 03 2015 17:16
Are TypedActors deprecated?
Aaron Stannard
@Aaronontheweb
Aug 03 2015 17:28
@nibblesnbits yes, someone submitted a fix for that within the NUnit testkit recently. #1065 - we're releasing Akka.NET v1.0.4 tomorrow which includes the bugfix for this
sorry for the inconvenience!
@stevemesser yeah, kind of - they're a bit a misnomer. The ReceiveActorreally strips away the need to have them
@lepinay @Horusiath could you guys add a DU serialization unit test to the F# specs?
Stephen Collins
@nibblesnbits
Aug 03 2015 17:29
awesome. thank you, @Aaronontheweb
Aaron Stannard
@Aaronontheweb
Aug 03 2015 17:30
that'd be the best way to clear up the mystery around that one :p
@nibblesnbits anytime! I'm an NUnit guy myself and I got bit with that bug too :p

@Aaronontheweb when working on multi node test runner, I've got following message on the test start:

[NODE1][2015-08-01 07:42:20][DEBUG][[akka://MultiNodeClusterSpec/system/cluster/core/daemon]]: No seed-nodes configured, manual cluster join required

Is it expected?

@Horusiath regarding that - yep. That's how the multi-node test runner does it's thing
doesn't bake any seed nodes into configuration - it uses the AwaitClusterUp to manually join nodes
@Horusiath I realized this morning, BTW, regarding #1196 - the MultiNodeTestRunner already emits a big JSON files that contains structured and time-ordered data for a multinode test run
we could build a static HTML5 + JS web app that could just load that file and render it
what do you think of that idea?
the JSON file also sorts that data out per-node, forgot to mention that
Sean Gilliam
@sean-gilliam
Aug 03 2015 17:57
is there a baked-in way to run actors in the same system under different credentials (e.g. Windows Impersonation)? I'm thinking not since it's not mentioned anywhere, but I thought I'd ask.
stevemesser
@stevemesser
Aug 03 2015 17:57
@Aaronontheweb hum.. That's too bad. I thought the TypedActor was a cleaner approach.
Aaron Stannard
@Aaronontheweb
Aug 03 2015 17:57
@sean-gilliam nah, that whole area sits outside the ActorSystem itself
that's a detail of the process hosting the ActorSystem
like the Windows Service or the ASP.NET application running it
the actors are just a detail of how that process works
@stevemesser yeah, I liked the approach too back in the day
came to love ReceiveActors though
you can't do stuff like implement behavior-switching with TypedActor
and at some point in the future, we're going to have true typed actors and typed actor references
stevemesser
@stevemesser
Aug 03 2015 18:02
@Aaronontheweb Yeah I read that about behavior-switching... until the true typed actor then.
Sean Gilliam
@sean-gilliam
Aug 03 2015 18:03
@Aaronontheweb got it. I can just juggle it inside the code. Just being lazy is all ;P
Roger Johansson
@rogeralsing
Aug 03 2015 18:04
@Aaronontheweb :+1: on the html5 js viewer
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 18:13
@Horusiath working on DU bugs
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 18:36
@rogeralsing I've got the problem with DUs. Issue is that before we cast JObject to a final type (DU in this case) we pattern match it first against that final type... which ofc is always false
Roger Johansson
@rogeralsing
Aug 03 2015 18:41
@Horusiath inside the json serializer?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 18:41
no, it's a part of Akka.FSharp
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 19:35
@Aaronontheweb do you think we could use Akka.Remote.MessageSerializer to include FSharp types in the manifest?
Aaron Stannard
@Aaronontheweb
Aug 03 2015 19:37
that doesn't involve modifying the protobuf, right?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 19:37
no, it doesn't
Aaron Stannard
@Aaronontheweb
Aug 03 2015 19:37
so what would need to change then?
needing to add a reference to FSharp.Core ?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 19:38
also @rogeralsing F# DU deserialization tests are false positives, because we use them out of the context
in test cases we are deserializing with explicitly given known type, while newtonsoft deserializer has to deserialize the binary without known type provided
@Aaronontheweb if we need to, then the solution is probably wrong :)
Aaron Stannard
@Aaronontheweb
Aug 03 2015 19:41
@Aaronontheweb if we need to, then the solution is probably wrong :)
You and I think alike
:thumbsup:
yeah, if you extend the manifest to include F# types I don't think it'll do any harm
the multi-node tests will burst into flames if anything goes wrong
so you'll know :p
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 19:43
there are multiple solutions, I'll try to include DU type in message manifes, but I'm worried that we might need to either explicitly reference json.net in akka.fsharp (now it's implicit as akka dependency) or use reflection
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 20:07

I've got the solution but it uses reflection :/

let (|JObj|_|) o =
            let t = typeof<'Message>
            let jobjType = Type.GetType("Newtonsoft.Json.Linq.JObject, Newtonsoft.Json") 
            if o <> null && o.GetType().Equals jobjType 
            then 
                let mInv = jobjType.GetMethod("ToObject", [|typeof<System.Type>|])
                Some (mInv.Invoke(o, [|t|]) :?> 'Message)
            else None

this is extension for F# pattern mathing that tries to cast passed object to json.net JObject and invoke explicit type conversion to final type on it

@rogeralsing some other sugestions?
Roger Johansson
@rogeralsing
Aug 03 2015 20:11
imo move let mInv = jobjType.GetMethod("ToObject", [|typeof<System.Type>|])and let jobjType = Type.GetType("Newtonsoft.Json.Linq.JObject, Newtonsoft.Json") out of that function and store static. expensive lookups
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 20:11
but beside that?
Aaron Stannard
@Aaronontheweb
Aug 03 2015 20:12
@rogeralsing @Horusiath btw, either of you looked at #1202 yet>
Roger Johansson
@rogeralsing
Aug 03 2015 20:14
the issue is still that json.net doesnt pass the $type name in the json for DU's and the json serializer doesnt use the manifest when remoting is enabled, right?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 20:15
@rogeralsing this is the beauty, DU don't have $type field :)
they are resolved somehow in different way
Roger Johansson
@rogeralsing
Aug 03 2015 20:16
I still dont get why, they do have a base type in the clr
in the IL i mean
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 20:17
this is output JSON of failing case: {"Case":"DoWork","Fields":["Long Work"]}
DoWork is union type case
Roger Johansson
@rogeralsing
Aug 03 2015 21:08
@Horusiath so if the type is missing from the message, its not in the json, and not in the manifest as jsonserializer dont use manifest. how can your function solve this?
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:09
Meh, DLR supports caching all that reflection stuff
Why does F# not support dynamic?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:10
json.net has JObject.ToObject(Type) method, that is used to try to cast JObject to specified type. And in F# Actors we know what message type we're expecting
Roger Johansson
@rogeralsing
Aug 03 2015 21:10
but where do you get the specific type?
Aaron Stannard
@Aaronontheweb
Aug 03 2015 21:10
@kekekeks wouldn't that open F# up to nullability, which is a big no-no of the language?
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:11
They already can get nulls from whatever source
Aaron Stannard
@Aaronontheweb
Aug 03 2015 21:12
@rogeralsing @Horusiath we all know where this conversation is going to end ;)
interface IDiscriminatedUnionSurrogate
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:12
@kekekeks but they are usually converted to options, and can be easily dealt with in compile time (usually)
@rogeralsing what do you mean?
Roger Johansson
@rogeralsing
Aug 03 2015 21:12
ooohh, I get it now I think, the remoting layer gives you a JObject as the serializer failed to deserialize the object? and that is passed into the F# receive function?
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:12
yes
Aaron Stannard
@Aaronontheweb
Aug 03 2015 21:12
(I was just kidding, by the way)
Roger Johansson
@rogeralsing
Aug 03 2015 21:14
so you want to check if the message is jobject and then translate it somewhere inside the infrastructure of the f# receive, right?
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:14
BTW, nemerle guys promised to start working on nemerle 2 in september. Nitra seems to be nearly done.
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:15
yes, this is what the method I've pasted is for
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:15
Chances are, that we'll get a CLR-based scala-like language with proper IDE support next year
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:16
Nemerle is not scala-like ;)
Roger Johansson
@rogeralsing
Aug 03 2015 21:16
I want to port the Scala compiler :)
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:18
Well, in terms of beeing on "FP <--> OOP" scale of things Nemerle is Scala-like
Roger Johansson
@rogeralsing
Aug 03 2015 21:19
I think that jobj trick will do it. a bit fugly but we have wrestled with this DU issue for far too long now
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:19
I mean, you can have all these FP-related goodies and still live in OOP world
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:20
@rogeralsing not possible, you won't get HKT in CLR, even if you use tricks, Scala uses
Roger Johansson
@rogeralsing
Aug 03 2015 21:22
@Horusiath ofc its possible, it just wont be compatible with other .NET langs, you can emulate everything with your own object graph. maybe slow and incompatible, but surly it would work?
Nikita Tsukanov
@kekekeks
Aug 03 2015 21:23
Embed intermediate-representation in resources, emit HKT code at compile-time
Bartosz Sypytkowski
@Horusiath
Aug 03 2015 21:29
#1203 just added
Roger Johansson
@rogeralsing
Aug 03 2015 21:36
btw. @Horusiath what does this syntax do? let (|JObj|_|) I get that the JObj can be used for pattern matching, but what is the _ for?
jberzy
@jberzy
Aug 03 2015 23:50
@rogeralsing that underscore means that it won't necessarily match that case.
i.e. it can be a JObj or something else.
jberzy
@jberzy
Aug 03 2015 23:58
sometimes people use active patterns for type conversion/parsing where the input is expected to succeed. in that case you can just do this
let (|JObj|) and then the caller does not have to handle any other cases.