I would like to better understand how a Receptionist actor is going to work.
val receptionist: ActorRef[Command] = ctx.spawn(Props(Receptionist.behavior), "receptionist")
receptionist ! Register(MySystem, someActor)([1])
receptionist ! Find(MySystem)([2])
[1] why it is expected to pass to “replyTo” argument already registered (ActorRef[Registered[MyCommand]])?
[2 ]If I want to find an actor I would like to have ask pattern like
val actor = receptionist ? Find(MySystem)(“some unique name”)
but now I am expected to pass type ActorRef[Listing[MyCommand]] which looks like a reply from a Find command.
What I get now is a list of actors of given type. Does it mean, that if I want to look for one specific actor I have to define multiple ServiceKey objects?
How to obtain an Actor to work with during message processing? Can it be passed only directly to behavior or through the message?
I can define behavior of type ActorRef[Registered[MyCommand]] but it cannot be at the same type ActorRef[Listing[MyCommand]],
so one actor cannot register and find actors.
Thank you,
Leszek