Rather than simply sending all messages to the child actor, you could only 
send messages in response to a "request for work" message from the child, 
holding all other messages in an internal queue until ready.  Then, if the 
child stops itself, it *won't* request work and the parent will correctly 
receive the Terminated message.

I use this pattern a *lot* in our Akka codebase and it's very helpful in 
these situations.

http://letitcrash.com/post/29044669086/balancing-workload-across-nodes-with-akka-2

(Company 
blog) 
http://blog.conspire.com/post/64901258135/akka-at-conspire-part-5-the-importance-of-pulling

On Wednesday, December 10, 2014 7:45:38 AM UTC-7, Anders Båtstrand wrote:
>
> After closer investigation, I found out that context().stop(self()) 
> actually stops the actor before the next message is processed. But the 
> parent receives the Terminated-message AFTER it has delegated the next 
> message to the dying actor, so the message is in dead-letters. So the 
> problem is the same, even if my theory about why it happened was wrong...
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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