Message passing between actors
Merely logging the API response is not very useful. To traverse the follower graph, we must perform the following:
Check the return code of the response to make sure that the GitHub API was happy with our request
Parse the response as JSON
Extract the login names of the followers and, if we have not fetched them already, push them into the queue
You learned how to do all these things in Chapter 7, Web APIs, but not in the context of actors.
We could just add the additional processing steps to the receive
method of our Fetcher
actor: we could add further transformations to the API response by future composition. However, having actors do several different things, and possibly failing in several different ways, is an anti-pattern: when we learn about managing the actor life cycle, we will see that it becomes much more difficult to reason about our actor systems if the actors contain several bits of logic.
We will therefore use a pipeline of three different actors:
The...