Hi Mark,
since you are building a concurrent system based on messaging (Actors),
you can never safely know that a "queue is really and finally empty" *just* by
looking at the queue.
Reason: there might be a message in flight to this Actor, and the second
after you've inspected the queue to be empty the message arrives.

So it must be either timeouts (doesn't make sense in your case) or protocol
level messages which signal completion.
What you're looking for here it essentially the Reaper pattern:
http://letitcrash.com/post/30165507578/shutdown-patterns-in-akka-2
which essencially is what you described - coordinated waiting for signals
of completion.

Hope this helps to understand the *why* and then *how* one should tackle
these problems!

On Wed, Apr 1, 2015 at 9:05 PM, Mark Kaberman <[email protected]> wrote:

> I am trying to find a way to find out when all children actors are
> finished working (processed all the messages in their respective queues).
> Think about graph traversal when each vertex discovery requires its own
> actor. The depth of the tree is finite and known and each level is requires
> its own actor, but the breadth is not. The only way I can think of to
> figure out that there are no more vertices to discover is to implement an
> event bus.  Each actor will send one event (+) when it starts the
> processing and another (-) whenprocessing is complete. The messages are
> received by some sort of supervising actor and once the total sum of all
> messages equals zero traversal is complete. This approach seems to be
> kludgy and fragile ( I have to introduce some sort of correlation id since
> multiple graph traversals can be running in parallel). I am wondering if
> there a simpler solution (monitoring all children's message queues)?
>
>  --
> >>>>>>>>>> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> 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 http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      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
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to