These are chat archives for akkadotnet/akka.net

13th
Sep 2017
Roman Golenok
@shersh
Sep 13 2017 00:01

Hello guys, it's me. again =) Currently I'm working on creating multiplayer server for turn-based game written on Unity. And I found interested lib for that - https://github.com/SaladLab/Akka.Interfaced and other from this man.
Main goal of these libs is give an opportunity to interact with Akka from Unity client via "SlimSocket". It's look like RPC.

But, I'm not sure that it is RIGHT way for that. What do you think?

Andrew Spiering
@wackoisgod
Sep 13 2017 00:26
That lib is rather out of date. I have worked on several games that used Akka on the backend, with a direct socket connection. I don’t know if Akka on the client is really required but depends on the games needs I guess.
Ricky Blankenaufulland
@ZoolWay
Sep 13 2017 07:00
I am thinking about breaking down a very huge actor. It has lots of lines of code and several state variables and behaviors. I though into delegating its tasks into some sort of sub-controllers buth those would not have actor funtionality (e.g. Context, Self..) available. Doing this by having more children actors creates the problem that the state must be shared and that is something you do not do accross actors. Any recommendations?
Jimmy Hannon
@JimmyHannon
Sep 13 2017 07:03
@zbynek001 No, i just stop the application (the hard way). It is like simulating som sort of failure.
Roman Alexis Anastasini
@foliba
Sep 13 2017 07:28
Hey @shersh we're doing quite the similar thing here. Multiplayer real-time mobile game with an Unity client with a HTTP (ServiceStack) and RealTime (Akka.Net) server. We are using SignalR (websockets with fallbacks) as a communication layer.
It's working very well so far. Highly recommend.
Wouldn't see the huge benefit of AKKA for a turn based games tbh. That might be simpler to achieve with a boring RESTful API, storing the game state in DB/cache.
zbynek001
@zbynek001
Sep 13 2017 07:31
@JimmyHannon in that case it's behaving correctly. Sharding will rebalance only when the node is removed from cluster. You need some kind of downing provider which will remove the nodes from cluster in such cases
jalchr
@jalchr
Sep 13 2017 07:35
@foliba @shersh Akka should work well for Real-Time games as well @Aaronontheweb ?
Roman Alexis Anastasini
@foliba
Sep 13 2017 07:39
It does!
That's what we are using it for. ;-) and are very happy with.
Zetanova
@Zetanova
Sep 13 2017 07:56
@uatec sry, had my holidays
still open problem?
Does somebody know a good pattern in akka.net to recreate an actor by path after a system restart?
I did for that a own actorRef and path types to warp the resovled actorRef around and hold an persistent-path to reolve the actorRef on first request
Gregorius Soedharmo
@Arkatufus
Sep 13 2017 08:59
@shersh looks fine to me, have you tested it?
@jalchr real-time Akka.Net and Unity is still experimental right now, I did manage to build a simple client-server chat using Akka.Remote
the real problem is that it can only work for PC and Android under Mono 4.6, anything that uses AOT would fail
ie. IL2CPP targets
Gregorius Soedharmo
@Arkatufus
Sep 13 2017 09:05
The recommended approach is to route requests through a proxy, Web API or socket server, and do a message transform between the Akka.Net backend and the Unity client
at least for now, that is
Roman Golenok
@shersh
Sep 13 2017 09:49
@Arkatufus I have tried examples provided in repository. And it's works... I found on slideshare presentations from this guy where he explain it. And now I should decide use it or not in real production
Gregorius Soedharmo
@Arkatufus
Sep 13 2017 09:51
I really can't decide that for you :)
Roman Golenok
@shersh
Sep 13 2017 09:52
Of course :)
kwojciechowski
@kwojciechowski
Sep 13 2017 10:18
does anyone tried to run akka on azure appservice with remoting (remote connection to another system running VM)? Im struggling with the configuration. I found that appservice akka system is trying to run on port -1
jalchr
@jalchr
Sep 13 2017 11:32
I used a web socket server for my game. It would be great if akka.net supported websockets natively. I wonder if there are plans?!
Gregorius Soedharmo
@Arkatufus
Sep 13 2017 11:41
have you tried SignalR?
implementing websocket would be hard since it is a wonky spec to begin with, with irregular adoption by different browsers
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 11:49
@jalchr first we need to finish TLS layer for Akka.Streams.IO.Tcp (I'm working on this), then start porting Akka.Http.Core - then websockets would be there :P
it's possible but time consuming ;)
another approach is to bring i.e. Reactive.Streams interface to SignalR itself (.net core version already supports Observables afaik)
and one more approach is to build a plugin around SinalR which will setup necessary interfaces (there's one in Alpakka project, but it needs more work)
jalchr
@jalchr
Sep 13 2017 12:44

@Horusiath yeh, its a long path ahead. I believe you need this at the core level to support streams and actors altogether. Its kinda full replacement of TCP, while signalr is a library.

Another question, has anything changed regarding ActorSelection ?
var remoteActor = Startup.ClusterSystem.ActorSelection("akka.tcp://MySystem@127.0.0.1:6667/user/api")
This is failing somehow after upgrading to v1.3.1

Bartosz Sypytkowski
@Horusiath
Sep 13 2017 12:56
@jalchr can you create a github issue? Ideally with some reproduction steps. It may be something simple, but this will help solving it faster.
Stephen Newman
@goodisontoffee
Sep 13 2017 13:10
Am I able to help with getting Akka.Monitoring up to 1.3.1? Are the plugins also up for grabs?
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:11
@goodisontoffee I think, that no one will opose if you want to help with akka.monitoring
Robert Stiff
@uatec
Sep 13 2017 13:12
@Horusiath i've been looking through the chat history, and you always respond to this type of question :)
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:12
also there are several different tasks marked in github issues as up-for-grabs: https://github.com/akkadotnet/akka.net/issues?q=is%3Aopen+is%3Aissue+label%3A%22up+for+grabs%22
Stephen Newman
@goodisontoffee
Sep 13 2017 13:12
@Horusiath sweet
jalchr
@jalchr
Sep 13 2017 13:13
:D sure
Robert Stiff
@uatec
Sep 13 2017 13:14
i want to use DeleteSnapshots to get rid of old snapshots, but i can't do Command<SaveSnapshotSuccess>(...) because I am using PersistentFSM
do you know how to do that on PersistentFSM?
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:20
@uatec I was not present in building PersistentFSM, but AFAIK it's extending PersistentActor so you should be able to retrieve this.LastSequenceNr from it. You can use it to this.DeleteSnapshots(new SnapshotSelectionCriteria(this.LastSequenceNr-1, DateTime.UtcNow)) to delete all snapshots before the latests one
Robert Stiff
@uatec
Sep 13 2017 13:21
yeah, it does have LastSequenceNr, but it's subscribing to the event
unless
i can just do it within my When(state, evt => ...)
Robert Stiff
@uatec
Sep 13 2017 13:28
so i have a snapshot journal, and a snapshotssnapshots
Zetanova
@Zetanova
Sep 13 2017 13:34
@Horusiath If a have a persistent path of an untyped subscriber/observer of a stream/source. Is there a good pattern to retreace the subscriber/observer after a system restart?
Zetanova
@Zetanova
Sep 13 2017 13:40
the only option what i see, is that the source is checking the identity of the subscriptions on system-restart and unsubscribs non existings subscribers
and now i am looking for an option to recreate the subscriber on demand by path, when the producer has his system-restart
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:44
@uatec I don't know your case exactly, I'm not sure if I can help any further.
@Zetanova about which feature are you talking about?
@jalchr I've added my 2 cents, I think I might have the same issue not so long ago.
Zetanova
@Zetanova
Sep 13 2017 13:49
@Horusiath generic pattern, if some component is subscribing to an stream-source and the -stream-source is responding with the message-stream. This subscription should persist over a system.restart.
I cant find a way to recreate the subscribing actor by path
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:51
@Zetanova what is that stream/source? Cluster sharding sounds like the most probable solution for that
Zetanova
@Zetanova
Sep 13 2017 13:51
pop3
is the stream source :)
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:53
I'd send it to a shardingRegion of cluster sharding with info about the destination or custom gateway actor able to recreate actors on demand - but both of those are basically the same
Zetanova
@Zetanova
Sep 13 2017 13:56
if the consumer is subscribing over a gateway actor, then the hole message-stream need to be tagged with an id, that the gateway can understand
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:56
yes
Zetanova
@Zetanova
Sep 13 2017 13:58
that i wanted to negate
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 13:58
you need some kind of id, actor path is an id too
Zetanova
@Zetanova
Sep 13 2017 13:59
yes, but then the sender in the subscription would be the gate-actor
the subscription-message i can extend, but the message-stream i dont realy want
maybe just to put the "gate"-actor into the supscription-message. Then the source can check over the identity-message the subscriber and if needs to by ask the "gate" to create it
Bartosz Sypytkowski
@Horusiath
Sep 13 2017 14:03
message can contain something like IActorRef ReplyTo field - it's a common pattern, used instead of direct Sender mechanics
Zetanova
@Zetanova
Sep 13 2017 14:18
ok, thx, maybe i just overthinking it again.
Aaron Stannard
@Aaronontheweb
Sep 13 2017 14:35
Am I able to help with getting Akka.Monitoring up to 1.3.1? Are the plugins also up for grabs?
@goodisontoffee I'll be getting on that as soon as I'm done with Petabridge.Cmd
which I'm almost finished with
knee deep in rewriting 100% of Petabridge.Cmd's serialization as protobufs since the thought of having to ship two different pbm clients, one for .NET Core and one for .NET Full, disgusts me
so I need to get that up and running and then I should be able to release it lol
Aaron Stannard
@Aaronontheweb
Sep 13 2017 14:42
since the thought of having to ship two different pbm clients, one for .NET Core and one for .NET Full, disgusts me
to clarify
that's what I'd need to do if I used Hyperion or JSON.NET polymorphic serialization, which has been the default
if I use something like MsgPack or Protobuf, a .NET client and a .NET Core server can interop no problem. All of the weird namespace change stuff becomes a non-issue
vicosoft4real
@vicosoft4real
Sep 13 2017 16:40
What is the best way of configuring these serialization libraries to work well with dotnet core. i' m using Hyperion as my default serialization in all remotes. any time my client system joins the node, i do have this exception. : [ERROR][9/13/2017 4:30:56 PM][Thread 0003][akka://EduSaaSSystem/system/transports/akkaprotocolmanager.tcp.0] Type must not be a pointer type
Parameter name: type
Cause: Hyperion.ValueSerializers.UnsupportedTypeException: Type must not be a pointer type
Parameter name: type at Hyperion.ValueSerializers.UnsupportedTypeSerializer.WriteManifest(Stream s
tream, SerializerSession session) at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Akka.Serialization.HyperionSerializer.ToBinary(Object obj)
at Akka.Actor.ActorCell.MakeChild(Props props, String name, Boolean async, Bo
olean systemService)
at Akka.Actor.ActorCell.ActorOf(Props props, String name, Boolean isAsync, Bo
olean isSystemService)
at Akka.Actor.ActorCell.ActorOf(Props props, String name)
at Akka.Remote.Transport.AkkaProtocolManager.<Ready>b5_0(InboundAssociation
ia)
at Akka.Case.WithTMessage
at Akka.Remote.Transport.AkkaProtocolManager.Ready(Object message)
at Akka.Actor.ActorCell.<>c
DisplayClass106_0.<Akka.Actor.IUntypedActorConte xt.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)
My light house dotnetcore config and client system config: serializers {
hyperion = ""Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion""
akka-cluster = ""Akka.Cluster.Serialization.ClusterMessageSerializer, Akka.Cluster""
                            }
                            serialization-bindings {
                                        ""System.Object"" = hyperion
                                        ""Akka.Cluster.IClusterMessage, Akka.Cluster"" = akka-cluster
                                         ""Akka.Cluster.Routing.ClusterRouterPool, Akka.Cluster"" = akka-cluster
                                }
                        serialization-identifiers {
                                    ""Akka.Cluster.Serialization.ClusterMessageSerializer, Akka.Cluster"" = 5
                                        }
vicosoft4real
@vicosoft4real
Sep 13 2017 16:48
Sample of my actor messages : public class Msg
{
public Msg(string propA, string propB, string[] propC)
{
PropA = propA;
PropB = propB;
PropC = propC;
    }
    public string PropA { get;  }
    public string PropB { get;  }
    public string[] PropC { get;  }
}
do i have to make my getter, setter public?
@Aaronontheweb @Horusiath kindly advise.
Roman Golenok
@shersh
Sep 13 2017 17:17
Are there any benefits of using akka.net with docker ?
Joshua Garnett
@joshgarnett
Sep 13 2017 17:46
@shersh no more benefit than using anything else with Docker. We use Docker at my company.
One of the challanges I’ve run into in the past is handling networking within containers + Akka remoting
Ended up using an overlay network (flanneld) for dev/stage/etc… On prod we used host based networking to avoid any problems.
Aaron Stannard
@Aaronontheweb
Sep 13 2017 18:23
@vicosoft4real wth... that's bizarre
Robert Stiff
@uatec
Sep 13 2017 18:41
@shersh i am using it in kubernetes, it works very well, but mostly it's just a really good way to deploy microservices
@joshgarnett i think calico routes natively when it can . and only uses the overlay when it needs to
Roman Alexis Anastasini
@foliba
Sep 13 2017 19:14
Ha, good to hear. We ran into the same issues as @joshgarnett ;-)
And came to the same fix...
vicosoft4real
@vicosoft4real
Sep 13 2017 19:58

@Aaronontheweb Sorry i wasn't around:
What is the best way of configuring these serialization libraries to work well with dotnet core. i' m using Hyperion as my default serialization in all remotes. any time my client system joins the node, i do have this exception. : [ERROR][9/13/2017 4:30:56 PM][Thread 0003][akka://EduSaaSSystem/system/transports/akkaprotocolmanager.tcp.0] Type must not be a pointer type
Parameter name: type Cause: Hyperion.ValueSerializers.UnsupportedTypeException: Type must not be a pointer type
Parameter name: type at Hyperion.ValueSerializers.UnsupportedTypeSerializer.WriteManifest(Stream s
tream, SerializerSession session) at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Hyperion.Extensions.StreamEx.WriteObject(Stream stream, Object value, Type
valueType, ValueSerializer valueSerializer, Boolean preserveObjectReferences, S
erializerSession session)
at lambda_method(Closure , Stream , Object , SerializerSession )
at Akka.Serialization.HyperionSerializer.ToBinary(Object obj)
at Akka.Actor.ActorCell.MakeChild(Props props, String name, Boolean async, Bo
olean systemService)
at Akka.Actor.ActorCell.ActorOf(Props props, String name, Boolean isAsync, Bo
olean isSystemService)
at Akka.Actor.ActorCell.ActorOf(Props props, String name)
at Akka.Remote.Transport.AkkaProtocolManager.<Ready>b5_0(InboundAssociation
ia)
at Akka.Case.WithTMessage
at Akka.Remote.Transport.AkkaProtocolManager.Ready(Object message)
at Akka.Actor.ActorCell.<>c
DisplayClass106_0.<Akka.Actor.IUntypedActorConte xt.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)
My light house dotnetcore config and client system config: serializers {
hyperion = ""Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion""
akka-cluster = ""Akka.Cluster.Serialization.ClusterMessageSerializer, Akka.Cluster""

                            }
                            serialization-bindings {
                                        ""System.Object"" = hyperion
                                        ""Akka.Cluster.IClusterMessage, Akka.Cluster"" = akka-cluster
                                         ""Akka.Cluster.Routing.ClusterRouterPool, Akka.Cluster"" = akka-cluster
                                }
                        serialization-identifiers {
                                    ""Akka.Cluster.Serialization.ClusterMessageSerializer, Akka.Cluster"" = 5
                                        }

@vicosoft4real
Sample of my actor messages : public class Msg
{
public Msg(string propA, string propB, string[] propC)
{
PropA = propA;
PropB = propB;
PropC = propC;

    }
    public string PropA { get;  }
    public string PropB { get;  }
    public string[] PropC { get;  }
}

do i have to make my getter, setter public?

Jimmy Hannon
@JimmyHannon
Sep 13 2017 20:01
@zbynek001 Thanks for your tip about the downing of a died node. Setting the auto-down-unreachable-after property in the configuration did the trick. I should have read the docs before...
vicosoft4real
@vicosoft4real
Sep 13 2017 20:21
@Aaronontheweb Thanks in advance for pointing me to the right direction.
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:21
I honestly have no idea with that one
that's like a raging tire-fire of a bug
and the .NET Core stuff is so new that I don't have any good prescriptive advice on how to handle that stuff yet
honestly, with that stuff going on, you have two choices:
vicosoft4real
@vicosoft4real
Sep 13 2017 20:23
What are the two choices?
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:23
  1. Trial-and-error your way through whatever the hell is going with Hyperion, because I've never seen that before; or
  2. Don't rely on Polymorphic serialization and use something like your own protobuf stuff instead
vicosoft4real
@vicosoft4real
Sep 13 2017 20:26
ok. like creating my custom protobuf serialization
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:27
yeah
MsgPack is another option
.NET Core has thrown a massive grenade in the middle of all of the polymorphic serialization stuff
vicosoft4real
@vicosoft4real
Sep 13 2017 20:27
Let me dig down more, I will feed you back my result.
Joshua Garnett
@joshgarnett
Sep 13 2017 20:28
protobuf ftw :)
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:28
and figuring out how to put everything back together and make that stuff work is going to be a lot of "oh, this thing that used to work doesn't anymore..." type experiences
in my own projects I've basically ditched Hyperion and moved onto Protobuf
it's more work to set up initially but it takes a lot of effort for someone to screw up once you have it up and running
Joshua Garnett
@joshgarnett
Sep 13 2017 20:29
Yeah, it has a solid migration path
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:29
even more than that, it has explicit schema
someone has to go through a lot of effort to change it in a way that is "accidental"
which was always the big worry with things like our JSON.NET and Hyperion serialization
someone could just change a constructor signature on a POCO and your serializer explodes
and most developers don't have a complete enough picture of the entire system to know that that's what they're doing when they change it
Joshua Garnett
@joshgarnett
Sep 13 2017 20:31
Yeah
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:31
I really like the Protobuf approach because it strips out a layer of magic that isn't always reliable
and institutionalizes everything in a schema file
like my thought process there is less about the technical benefits and more about the human ones
Joshua Garnett
@joshgarnett
Sep 13 2017 20:32
Which are some of the harder problems to solve
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:33
yeah, +1 to that
the technical benefits are good too though - forward compatibility is huge
and protobuf is highly compressed
so it's easier on the network
Joshua Garnett
@joshgarnett
Sep 13 2017 20:34
The biggest challenge we are having with protobuf is that they are mutable
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:34
all of the protobuf messages I've defined for the new version of Petabridge.Cmd basically act like discriminated unions
@joshgarnett I do the same thing the built-in Akka.NET protobuf serializers do
translate the Protobuf message into an immutable C# one right at the serializer level
Joshua Garnett
@joshgarnett
Sep 13 2017 20:35
Our state is all protobuf based, we had a problem where we were just pushing the State reference with the Snapshot command. It was blowing up if had a message come in before the snapshot completed.
@Aaronontheweb how are you converting it into an immutable C# object?
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:37
nothing too fancy
manually mapping the properties from my protobuf message into a C# object that has read-only properties
Joshua Garnett
@joshgarnett
Sep 13 2017 20:37
Ahh
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:38
and if I have to expose a collection somewhere
Joshua Garnett
@joshgarnett
Sep 13 2017 20:38
Yeah we have 100s of protobuf messages
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:38
I always do it as IReadOnlyList or whatever
Joshua Garnett
@joshgarnett
Sep 13 2017 20:38
Doing boilerplate C# classes would be painful
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:38
IMHO, you could probably come up with a T4 template on top of your protobuf definitions
Joshua Garnett
@joshgarnett
Sep 13 2017 20:38
I really wish the C# version would just follow the builder pattern Java has.
Robert Stiff
@uatec
Sep 13 2017 20:38
@joshgarnett what's that pattern?
Aaron Stannard
@Aaronontheweb
Sep 13 2017 20:38
that could take the output of the C# protobuf compiler and give you a mapper over to something that is immutable
so it'd be another set of class generation on top of protobuf :p
Joshua Garnett
@joshgarnett
Sep 13 2017 20:39
You create protobufs with the builder classes. When you do message.build() that object you get back is immutable.
Yeah sounds like a headache :P
For the snapshot, I just did a clone on the state for now