Reputation: 345
I am new to Akka. I have 4 actors.
Actor1 sends Message1 to Actor4. Actor2 sends Message2 to Actor4. Actor3 sends Message3 to Actor4.
Actor4 should create Message4 when it receives 1 message of type Message1, 1 Message of type Message2 and 2 messages of type Message3.
Message4 = (Message1, Message2, Message3a, Message3b, Message3c)
What would be the best approach to do this?
Upvotes: 0
Views: 368
Reputation: 9194
I agree with Snickers3192, that you can use futures. You could also look into something like the Cameo Pattern from Jamie Allen. I have created some crude examples in another stackoverflow thread. These are all Scala and not Java.
Upvotes: 1
Reputation: 8107
If you have a task which depends on other tasks being completed whilst others can be done in parallel, you want to use futures, I have answered a question like this already, this is probably a duplicate question, and just a variation of the more general problem of performing tasks in parallel and distrubuting them across resources as best as possible, but anyway futures give a more clean solution to this problem in my opinion, check out my answer here Executing Dependent tasks in parallel in Java.
Upvotes: 1