What is the "I" in Akka?

Just by reading the Akka samples, can't you figure out how self.reply is self.reply ? As far as I can see, self reply used inside receive blocks to reply to a message. But as far as reply is a self method, then self is what?

PS: By the way, you can recommend a good article on quick articles about Akka basics and remote actors with Scala - I would appreciate it if you could post the link as a comment here. Now I am reading this one .

+6
source share
1 answer

self - A reference to an instance of ActorRef containing this actor.

When you create a new actor in Akka, the actorOf[class] method returns an instance of ActorRef, and not the actual implementation of Actor, the actor itself is hidden. This ActorRef is what you use to interact with the Actor. Thus, self can be used by the actor himself to obtain this link.

For example, if your actor wanted to send a message to himself, he would do

 self ! Message 
+18
source

Source: https://habr.com/ru/post/900643/


All Articles