Another approach that may as well deal with accidental issues, is to avoid 
awaiting on messages, this is how I do, and again, it is working like a 
charm, say you have the following scenario:

   - Actor A running on persistor-dispatcher needs to insert a record on 
   the DB and send the identity of that record, or the whole inserted new 
   record to Actor B which needs it.
   - Actor B will at pre-start send a message to actor A requesting such 
   record without waiting, just fire-and-forget, include the sender in your 
   message.
   - Actor A will answer the message with its new inserted record.
   - Actor B will set context timeout for say, 1 minute and before it 
   receives the record from Actor A, it stash all messages coming to it.
   - Actor B if receives timeout message, deal with it with your own logic, 
   say, keep working until number of timeouts exceed a number, say, 5 times or 
   just kill the actor because something is wrong on Actor A.
   - Actor B eventually receives the record from Actor A and at that moment 
   it will unstash all messages and do the normal processing.

Think of it as long running state machine without blocking, you are just 
reacting to either the eventual message or a timeout, does that cover all 
scenarios?, No, but I think it is a good approach to avoid blocking and 
waiting.

-- 
>>>>>>>>>>      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