Hi there!

We at Tiny Lab Productions are using Scala+Akka for our game servers. 
Recently I whined my ex-colleague and your current colleague at Akka 
Martynas Mickevičius about how untyped actor refs are turning everything 
into a hard to understand spaghetti and he kindly reminded me that 2.4.0 is 
our and akka-typed is available for experiments, so I should try it our and 
provide my feedback. So here I go ;)

Over the weekend I migrated akka, akka-io & spray project to akka, akka-io 
& akka-http. The migration probably can be improved, but I wanted to do it 
fast.

Code before: https://gist.github.com/anonymous/8bc271664f417024493d
Code after: https://gist.github.com/anonymous/28accfa8e5f3fe187c4d

Overall types in actor messaging felt very refreshing - before I had the 
feeling of "not sure how it's not falling apart", esp. given that this is a 
prototype and there are almost no tests written. Afterwards I have much 
more confidence in the code and changing it - now I can be pretty sure that 
the compiler will stop me when I do something stupid. I intend to keep 
writing akka-typed code for this project.

There were some downsides (mostly related to growing pains).

* akka-io. akka-http & logging expects untyped actor refs and systems, thus 
I had to extract the untyped versions out of typed using reflection. Given 
that there is a lot of code written in untyped akka, there needs to be an 
official way to do this. See package.scala.
* akka-http wanted an ActorMaterializer, which then killed my typed actor 
system because of the new guardian model. We could get ActorRefFactory from 
the ActorContext, except there is no way to get one from the typed context. 
Had to spin up an untyped actor system just for this. See GCMSender.scala
* akka-io heavily relies on sender(), thus TypedUntypedActorBridge had to 
be born - you need to create an adapter to move untyped messages to the 
typed actor, but when sending anything to akka-io you need to remember to 
fix sender to the adapter - otherwise your typed actor just ignores all the 
messages that akka-io is sending. You can see more of this in Server.scala 
& MsgHandler.scala.
* I had to write ActorContext[_].spawnAdapterUTRef - when interfacing with 
akka-io the sender() of the message is important and we need to store it.
* Terminated signal now returns ActorRef[_] which is fine if you only care 
about one type of actors, but suboptimal for several kinds. See 
TypedActorContextExts.watchWith & GamesManagerActor.scala to see an (IMHO) 
nice solution for this.

And also a question:
* I have no idea how supervision works anymore. Do you have to manually 
restart the child actors?

I think that's it. In conclusion I loved the ability to have types in my 
actor systems and REALLY hope this doesn't get dropped.



-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to