These are chat archives for petabridge/akka-bootcamp

Mar 2015
Paul Harker
Mar 18 2015 05:23
Why is the ButtonToggleActor an UntypedActor? What is the rationale to use UntypedActor or ReceiveActor? Seems like it's just more code to make an UntypedActor do the same stuff.
Aaron Stannard
Mar 18 2015 05:34
@HarleyRoadKing yep, it's totally arbitrary
best practice is to use the ReceiveActor
I used UntypedActor there for no particular reason
mostly so people could just see some examples of it I guess
Mar 18 2015 19:28
Hi, in lesson 3.4 there are two things pointed that using await breaks in message processing. It is also stated that async/await is just a sugar for using a task with a continuation. I don't understand why those two things that break message processing do not apply for the .ContinueWith version. Isn't it that it all only comes down to readability?
Aaron Stannard
Mar 18 2015 19:58
we have some open issues for dealing with this in Akka.NET, but here's the big issue with await - it's re-entrant
it goes back to the receive method and executes the portions of it after the await block in a different thread
which breaks the "one message at a time" processing guarantee that all actors are supposed to obey
so unless you are extremely careful
you will end up mutating actor state concurrently
and everything goes to hell
ContinueWith and PipeTo make it absolutely explicit that this is code running in a separate thread
and makes it much harder to make those types of mistakes
asynchrony in Akka.NET is meant to be done with messages
so PipeTo turns the results of a task into a message, effectively
some of the stuff we're working on now will make it so await will invisibly turn continuations into system messages
so in the future, await will work inside Akka.NET - although it's still not the recommended way of doing things
Timur Babyuk
Mar 18 2015 20:02
So maybe it's a case of custom awaiter?
Aaron Stannard
Mar 18 2015 20:02
@timba yeah, that's basically what we're implementing
it's taken a lot of time to get the performance / message processing semantics just right
but we're pretty close - you can see the discussion here: akkadotnet/
lol whooops
wrong PR
Timur Babyuk
Mar 18 2015 20:04
Got it, need to check
Aaron Stannard
Mar 18 2015 20:04
I meant this one: akkadotnet/
I haven't had much involvement in the engineering on that particular issue, so I couldn't tell you about the implementation details exactly