I have a hierarchy of singleton actors. The parent supervises and coordinates the children. I need to keep child actors running when the coordinator is restarted. Is there a way to prevent child actors from restarting when their parent is restarted or should I rethink my actor hierarchy? I have been looking into akka supervision strategy but couldn't find a definitive answer.
Asked
Active
Viewed 368 times
1 Answers
1
Children are restarted in the preRestart
callback, so if you override it on the parent and do not call super.preRestart
the children will not be restarted when the parent is.

johanandren
- 11,249
- 1
- 25
- 30
-
Thank you. I overrode preRestart on the parent actor and now children are not stopped and recreated upon the restart of the parent. However they are still being restarted (not by recreating child actors as it used to be the case). Child actors instances are now preserved but methods such as preRestart execute on them after the parent is restarted. Is there a way to prevent this from happening? It is a step in the right direction but I would like to simply suspend the children until the parent is restarted. – mateusz.s Nov 19 '15 at 10:27