In this chapter, you learn how an actor can find another actor that is not its child. For example, suppose a manager creates workers to parse files, and later you develop a statistics collector that is only concerned with how many workers there are and how much work they do. If the collector is not embedded when the workers are created, how can it find the workers to request the information it needs? In other words, how can you add this new collector without tangling it up with the manager/worker part?
In Akka Typed, this problem has been solved with the receptionist. The idea is simple: the receptionist registers and subscribes actors to a specific key. Thus, all subscribers to that key are notified when a registration occurs.
You also learn how to send messages to actors behind a proxy, called routers. Akka has two built-in routers, but you don’t always have to use them. In some cases, the best choice is to use simple actors as intermediaries.
Note
The source code for this chapter is available at www.manning.com/books/akka-in-action-second-edition or https://github.com/franciscolopezsan cho/akka-topics/tree/main/chapter06. You can find the contents of any snippet or listing in the .scala file with the same name as the class, object, or trait.