Created
March 26, 2016 18:34
-
-
Save rogeralsing/0c6e8b97035cc03db4a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
var jobs = db.GetJobs(..); | |
var aggregator = sys.ActorOf(Props.Create(() => new AggregatorActor(jobs.Count)); | |
foreach(var job in jobs) | |
{ | |
workerRouter.Tell(new JobMessage(job.Data, aggregator); | |
} | |
... | |
class AggregatorActor : ReceiveActor | |
{ | |
public AggregatorActor(int jobCount) | |
{ | |
Receive<JobDone>(msg => { | |
jobCount --; | |
if (jobCount == 0) //done | |
{ | |
//Tell someone | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment