- Constructor vs
preStart()
- Is it ok to create child actors in the constructor vs doing it in preStart() ?
Both the constructor and preStart()
are called during a restart. So it's absolutely fine to created child actors in the constructor. (Aside: when using preStart()
always call super.preStart()
first). If for some reason you don't want to create children during restart then use preStart()
for creating and make sure you overrride preRestart()