February 2017
Beginner to intermediate
1100 pages
25h 19m
English
The behavior of the fetcher manager depends on whether it has work to give out to the fetchers:
GiveMeWork messages with a Fetcher.Fetch messageGiveMeWork messages and, if work gets added, it must send a WorkAvailable message to the fetchersEncoding the notion of state is straightforward in Akka. We specify different receive methods and switch from one to the other depending on the state. We will define the following receive methods for our fetcher manager, corresponding to each of the states:
// receive method when the queue is empty def receiveWhileEmpty: Receive = { ... } // receive method when the queue is not empty def receiveWhileNotEmpty: ...Read now
Unlock full access