I'm working on a part of my Akka application which must gracefully shutdown 
when a shutdown hook has been detected. 

The use case of my question is in case of deployment while the application 
is making some tasks. In this specific case, we do want to delay the 
deployment until my actors have not finished their tasks. 

My application is composed by a ClusterGroup with a limited number of 
routees (worker actors). To make a graceful shutdown, I like idea in 
following article: 

Basically what I want to do is : 

   1. Create a Reaper as in the article, collected dead souls 
   2. A shutdown hook has been detected, send a PoisonPill to each actors 
   in my actor system (I have all the elements for that)
   3. When all worker actors has been killed with seeing PoisonPill 
   message, shutdown the actor system + the application (using System.exit or 
   something else)

My main problem is that I need a mechanism of Akka or Scala to wait (or to 
timeout) the termination of my worker actors. 

I'm using following code to detect that my application has been shutdown 
from an external signal : 

 scala.sys.addShutdownHook { 
    // let actors finished their work, blocking call ?


For reader of this question, I'm using Akka 2.5.7 and Scala 2.11.11. 

Can I have advices for such use case ? I don't think that I'm only one to 
make such things so I'm listening all ideas :)

>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to