I finally had the chance to use Akka Typed, and wanted to share my 
experience. So basically, I took a small demo project that was based on 
untyped actors, and implemented it using typed ones. (This is based on 
2.4.8, but I think most of it is still relevant)

To start off with the good things:
* Typed actors completely eliminated bugs involving mixing up `ActorRef`s - 
passing wrong refs, mixing up order of parameters, sending responses to the 
wrong place.
* The functional approach taken for typed actors (behaviors returning the 
next behavior) also eliminated bugs that revolved around "doing stuff from 
`Future` callbacks".
* The thing I was probably worried about most - not having `sender` any 
more - turned out to be a non-issue. In fact, because now it has to be on 
the received message, it makes it immutable, thus helping with the 
`Future`-related bugs.

Now for the "annoyances" (in no specific order):
* Using the various factory methods to create behaviors means you don't 
have direct access to "protected" behavior methods, most notably the 
ActorContext. If you need it, you either use `Actor.immutable` and get a 
"new" context with each message, or you use Actor.deferred which is a bit 
more clunky (you need a function that returns a behavior, which is itself a 
function).
* This is more of a Scala type-inference issue, but having to specify the 
type when using `ask` is pretty annoying. What seems to work best for me is 
having utility methods
on the "actor" that return `ActorRef[Response] => Message`, but it's a bit 
boilerplatey.
* Another issue related to asking is that there is no equivalent to untyped 
ask's Status.Failure. If the "request" can fail, this has to be modeled in 
the response (replying with a `Try`, or something equivalent), and means 
that now the caller has 3 cases to handle instead of 2. So now instead of 
ask-map-pipe in one line, it turns into
ask-transform(3 cases)-foreach.
* No "easy" access to logging - there's already a PR waiting for this, so 
not really an issue.

Overall, though, I have to say it's shaping up real nicely. I'm looking 
forward to see what happens to it next.

Tal

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to