In the preceding application, we created two actors:
- MasterActor: This actor listens for new work messages and sends them to a random worker actor. If there are no worker actors available, it simply drops the message. Also, it registers workers and stores their ActorRefs in a list. Every time a worker actor tries to register itself, it calls context.watch; this allows you to have a terminated message to remove the stopped worker from the list.
- WorkerActor: This actor waits for work messages and simulates some processing with Thread.sleep. Once done, it sends back a WorkDone message.
We also have two small Scala apps:
- ScalingOutMaster: This app creates a master actor and it listens in port 2552 for messages to come since we ...