On 21/02/2017 12:57, Justin du coeur wrote:
As I understand it, you want your parent to "wait" until it has collected all the info from the children before it moves on to doing something else. (Forgive me if I'm misunderstanding your use case -- it isn't spelled out in great detail above.)
It's not my use case or indeed my problem, I was just trying to follow along with the discussion from the original post and understand the advice that was being given in response to it :-)
The Akka-idiomatic way to do this is for the parent to do something like: -- Send out the jobs to the children -- become() into a different receive processor -- In this new processor, everything *other* than the responses from the children get stash()ed -- that is, you save them away for later -- Once you have accumulated all of the child responses (or timed out -- it is often adviseable to have a timeout scheduled), send out the aggregated response. Then unstash() everything that's been stored up, and become() back to your original state. Essentially, instead of waiting/blocking, you shunt everything else aside (queueing it, essentially) until you're ready to handle it. The effect is largely the same, but without tying up threads.
Ooh, that's neat - I like that. Is there a collection/book of such approaches anywhere? I've looked at a couple of books on Safari but I don't recollect seeing that one explained anywhere - although I may have just missed it.
I really like the "toolbox" approach of Akka but it can be a bit daunting to be given a box of spanners and then be expected to go build a car ;-)
-- Alan Burlison -- --
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/ Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
