A worker actor handles one assigned unit of a larger job, then returns a result to a coordinating actor. A guardian can pass a collection to a manager, which splits it into pieces and delegates each piece to workers. This keeps coordination separate from the business operation performed for each item. section 3.1 section 3.1.1
Messages flow from the manager to workers for processing, then back to the manager as completion notifications. section 3.1
A worker interaction commonly follows this sequence:
- Receive a command containing the work and a reply address. section 3.1.8 section 8.4.3
- Perform the narrow task, such as removing hyphens or counting words. section 3.1.8 section 8.4.3
- Send a result back so the coordinator can log completion, merge results, or handle failure. section 3.1.8 section 8.4.3
- Optionally stop after a single task, or remain available to process later messages. section 3.1.8 section 3.2.5
Parsing one text per worker
A manager creates one worker for each text. Each worker receives Parse with its text and a reply target, removes hyphens, sends Done, and stops. Because the worker response belongs to the worker’s protocol, the manager uses a message adapter to turn that response into a message it can handle. section 3.1.8 section 3.1.3
In clustered job processing, workers can run on aggregator nodes while a master runs on a director node. Workers register with a receptionist key, receive texts through a router, count words asynchronously, and return a Map of word frequencies. The master merges successful counts; timed-out work goes back to a lag queue for reprocessing. section 8.4 section 8.4.3
