Thanks for your feedback, Artūras! Comments inline.

> 25 okt 2015 kl. 14:00 skrev Artūras Šlajus <[email protected]>:
> 
> 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.

Great!

> 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.

Agreed.

> * 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

HTTP and Streams will need to be adapted to make full use of the typed 
capabilities and also to integrate with the slightly different approach to 
actor creation. That will be done once we move these sub-projects onto the 
master branch.

> * 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.

Same here: of course Akka IO needs akka.typed.ActorRef interfaces.

> * I had to write ActorContext[_].spawnAdapterUTRef - when interfacing with 
> akka-io the sender() of the message is important and we need to store it.

This will go away once IO has been adapted.

> * 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.

This is indeed a nice idea, could you file a ticket? I envision this to work 
like spawnAdapter—which will eventually be optimized into a lean and mean 
ActorRef without a backing Actor for efficiency.

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

The default now is to escalate, if you want to handle and restart then you’ll 
need to explicitly do so:

case Sig(ctx, f: Failed) =>
  ...
  f.decide(Failed.Restart)

> 
> 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.

This won’t be dropped :-)

Regards,

Roland


> 
> 
> 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
twitter: @rolandkuhn
 <http://twitter.com/#!/rolandkuhn>

-- 
>>>>>>>>>>      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