Generally, you want to use what we call the "Commander" pattern for this. Essentially, you have one stateful actor (the Commander
) that is responsible for starting and monitoring the task. You then farm out the actual work across the actor pool, and have them report back to the Commander
as they finish. The commander can then track the progress of the job by calculating # completions
/ size of worker pool
.
This way, the workers can be monitored and restarted independently as they do the work, but all the precious task-level state and information lives in the Commander (this is called the "Error Kernel pattern")
You can see an example of this in the Akka.NET scalable webcrawler demo.