These are chat archives for akkadotnet/akka.net

30th
Sep 2017
kariem-ali
@kariem-ali
Sep 30 2017 07:12
@object I posted a comment on how I got the snapshots and journal events to deserialize correctly in my case https://github.com/akkadotnet/akka.net/issues/3133#issuecomment-333289331. But as I mentioned in the comment, according to @Danthar, it seems that the different persistence plugins are at different stages of implementing this new change in serialization configuration. I am using Sqlite (the sqlite plugin fully implements the new change), it might be different for you since you are using Sql Server.
Bartosz Sypytkowski
@Horusiath
Sep 30 2017 07:46
@kariem-ali @object SqlServer and Sqlite have parity right now
kariem-ali
@kariem-ali
Sep 30 2017 08:01
@Horusiath Nice. Thanks for the feedback.
thechups
@thechups
Sep 30 2017 11:03
Good day, everyone! I have a stupid question, but i cant find answer on it. Sorry, im neewbie in Akka. So question is: Repository pattern in Akka. How i should implement it? Or this pattern totally not for Akka? So what the proper way to interact with database (MS Sql and Entity Framework) to store entities? Best Practices? It will be great if someone have examples, or tutorials? Thank you
Martin Helmer
@helmerm
Sep 30 2017 14:08
Akka.Remote.EndpointException: Failed to write message to the transport ---> System.Exception: Error tracking object  ---> System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Hyperion.SerializerSession.TrackSerializedObject(Object obj)
   --- End of inner exception stack trace ---
   at Hyperion.SerializerSession.TrackSerializedObject(Object obj)
   at lambda_method(Closure , Stream , Object , SerializerSession )
   at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, SerializerSession session)
   at lambda_method(Closure , Stream , Object , SerializerSession )
   at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, SerializerSession session)
   at lambda_method(Closure , Stream , Object , SerializerSession )
   at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, SerializerSession session)
   at Hyperion.SerializerFactories.ImmutableCollectionsSerializerFactory.<>c__DisplayClass5_0.<BuildSerializer>b__1(Stream stream, Object o, SerializerSession session)
   at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, SerializerSession session)
   at lambda_method(Closure , Stream , Object , SerializerSession )
   at Akka.Serialization.HyperionSerializer.ToBinary(Object obj)
   at Akka.Serialization.Serialization.SerializeWithTransport[T](ActorSystem system, Address address, Func`1 action)
   at Akka.Remote.MessageSerializer.Serialize(ActorSystem system, Address address, Object message)
   at Akka.Remote.EndpointWriter.WriteSend(Send send)
   --- End of inner exception stack trace ---
   at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel level, Boolean needToThrow)
   at Akka.Remote.EndpointWriter.WriteSend(Send send)
   at Akka.Remote.EndpointWriter.<Writing>b__27_0(Send s)
   at lambda_method(Closure , Object , Action`1 , Action`1 , Action`1 )
   at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture`4.Handle(T value)
   at Akka.Actor.ReceiveActor.ExecutePartialMessageHandler(Object message, PartialAction`1 partialAction)
   at Akka.Actor.ActorCell.<>c__DisplayClass106_0.<Akka.Actor.IUntypedActorContext.Become>b__0(Object m)
   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
   at Akka.Actor.ActorCell.ReceiveMessage(Object message)
   at Akka.Actor.ActorCell.Invoke(Envelope envelope)
Hi. I have a message, which causes this exception, if send twice. Could not track down the root cause yet...
I am working on a test case. However, any suggestions, what could cause this issue? First time send works, second time fails with the above exception.
Martin Helmer
@helmerm
Sep 30 2017 14:17
Something about my message type must be special...
Bartosz Sypytkowski
@Horusiath
Sep 30 2017 14:43
@helmerm looks like a Hyperion problem - if I understand correctly two of your objects in serialized object graph generate the same hash code.
you can turn off object tracking - akka.serialization.serialization-settings.hyperion.preserve-object-references = false (ofc if your alias for hyperion serializer in hocon config is in fact hyperion)
Martin Helmer
@helmerm
Sep 30 2017 15:01
I have some value objects in my object graph. Does the serializer does not support value objects?
@Horusiath Thanks for the config hint, I will try it
Martin Helmer
@helmerm
Sep 30 2017 15:13
@Horusiath config does not help. however, the fails seem to be random. I can run my test multiple times and sometimes the second call fails:
            var s = new HyperionSerializer((ExtendedActorSystem) Sys);
            s.ToBinary(failingMsg);
            s.ToBinary(failingMsg); // fails
Is there any concurrency involved in the ToBinary message?
Martin Helmer
@helmerm
Sep 30 2017 15:20
I will try to isolate it further in a console app. maybe the test runner causes weired behavior
Martin Helmer
@helmerm
Sep 30 2017 16:10
@Horusiath Thanks, it works with the config entry (akka.actor.serialization-settings.hyperion.preserve-object-references). However, I still do not get why it was failing randomly
Martin Helmer
@helmerm
Sep 30 2017 16:29
We internally use some types from System.Numerics (Vector3, Quaternion), I can not see there HashCode implementation
Aaron Stannard
@Aaronontheweb
Sep 30 2017 16:29
@thechups you can implement the repository pattern just like how you would in ASP.NET
trick is, Akka.NET actors can live forever
so those actors need to be armed with a way to re-acquire database connections over time
because the actor will typically live longer than the underlying connection
so constructor-based dependency injection will fail you there
better off passing a function to that actor it can use to acquire a fresh IRepository
and then let that actor be responsible for disposing it once it's done also
Aaron Stannard
@Aaronontheweb
Sep 30 2017 16:35
@joshgarnett I have not, personally
but have seen others who have
also seen a quite a few Mesos deployments thus far
thechups
@thechups
Sep 30 2017 16:44
@Aaronontheweb thank you very much!
Ricardo Abreu
@codenakama
Sep 30 2017 18:00
how can I retrieve an existing actor? I have a simple web api endpoint and I want to query the actorSystem for a child actor, if the child actor exists then I just tell it a message, otherwise create a new instance and tell the message.

I tried something like `
var clusterListener = _actorSystem.ActorOf("../clusterlistener").Anchor;

        if(clusterListener == null || !clusterListener.Path.ToString().Contains("clusterlistener")){
            clusterListener = _actorSystem.ActorOf(Props.Create(typeof(SimpleClusterListener)), "clusterlistener");
        clusterListener.Tell(new HelloMessage());

            return "actor created and hello sent";   
        }`

but it didnt work :/ I keep getting back the actorSystem itself

Ricardo Abreu
@codenakama
Sep 30 2017 22:16
I think I figured it out