These are chat archives for akkadotnet/akka.net

24th
Jan 2015
Aaron Stannard
@Aaronontheweb
Jan 24 2015 00:32
@Horusiath yes, we can do that - but that's a change that'd need to be made inside Helios
currently working on a spec for Helios 2.0 which includes a pipeline model for processing messages. Without the pipeline model it's very difficult to reference count and re-use byte buffers.
studied the Netty implementation of their SharedByteBuf stuff pretty closely when I wrote it
Roger Johansson
@rogeralsing
Jan 24 2015 10:49
we should add some stuff to the getakka.net startpage IMO.. reference to nuget clearly visible etc
Bartosz Sypytkowski
@Horusiath
Jan 24 2015 16:55

I was working on serializing ActorPath to use method the ActorRef uses - implicit conversions to/from ActorRefSurrogate. I've found something using following example:

var aref = ActorOf<InnerActor>();
var serializer = Sys.Serialization.FindSerializerFor(aref);
var bytes = serializer.ToBinary(aref);
var sref = (ActorRef)serializer.FromBinary(bytes, typeof(ActorRef));

What I didn't expected is that last line will cause InvalidCastException since FromBinary method returns object, which underneath is not an ActorRef but ActorRefSurrogate - custom implicit casts between two types cannot be performed if instance of one of them is casted down to object. In this case the second parameter of NewtonsoftJsonSerializer.FromBinary(Object, Type) method is totally ignored. Because of that custom json converter for ActorRef will never be invoked.

Roger Johansson
@rogeralsing
Jan 24 2015 17:58
The serialization of actorref is special special, it needs a context to serialize within. so that it can resolve correct address etc. My guess is that you need to set that up first before running that code
Ill have a peek
Roger Johansson
@rogeralsing
Jan 24 2015 18:10
ah, I think I know what is going on, the ActorRef needs to be a part of a message, then the serialization works, I guess we have never tried to pass an ActorRef alone
the serialization/deserialization does work, because w/o it,remoting wouldnt work. but I get that this specific example might not
when part of a message, the message will know that the property pointing to an actorref is of type actorrefsurrogate since the json serialized provides that type info in the message
Aaron Stannard
@Aaronontheweb
Jan 24 2015 20:51
@Aaronontheweb I agree with you about the site - we should make the "How to Install" or "Get Started!" stuff front and center