I am bit confused looking at the docs here and here
receive()
is a method which accepts no parameters and returns a Partial function. tell()
is a method which returns Unit
and it 'sends' the message. Now for the message to be processed in my understanding 2 things have to happen:
receive()
should be invoked by tellreceive()
Now if the partial function is returned back to the place where tell()
was used, then how does message based communication work? Why isn't the operation being performed inside the actor itself?
Because it is internals there is no documentation, but you can checkout source code yourself here: https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/actor/ActorCell.scala. All internals starting from how tell sends message to mailbox, how message is extracted from it, how receive is called and so on is here.
Hope it answers your question.