Actor Life Cycle
The following is the life cycle of an actor, including any hook methods.
- Actor initializes.
- PreStart() hook method is called.
- Actor is up and now able to process messages.
- Actor cleans up.
- PostStop() hook method is called, if actor is terminating.
- PreRestart() hook method is called, if actor is restarting.
- Actor is dead.
- Actor is going to restart.
- PostRestart() hook method is called.
- Called before actor instance receives its first message.
- Custom intialization code, preparing actor to start receiving messages.
- Opening/creating files, system handles, etc.
- Called after actor has been stopped and not receiving messages anymore.
- Custom cleanup code.
- Release system resources/handles such as file system.
- Called before actor begins restarting.
- Allows code to do something with current message/exception.
- Save current message for reprocessing when actor restarts.
- Called after PreRestart() and before PreStart()
- Allows code to do something with exception
- Additional custom diagnostic/logging