Using activity timers
Use activity timers to restart processes that are stuck because of application errors or other reasons. For example, a parent might set a timer that causes it to be reactivated after a specified period, if a particular child activity does not complete.
About this task
The best way to restart processes that are stuck for other reasons - including application errors - is to use timers. The parent names the timer in a way that associates it with a particular child. If the child completes within the specified period, the parent deletes the timer.
One reason for making the application responsible for restarting itself is that it is difficult from outside a process to tell whether the process is stuck or merely dormant, particularly if the process is long-lived. Processes of different types can have varying "natural" lifespans; and these lifespans can vary according to system load, availability of remote regions, and so on. The application itself is best placed to know how long each of its activities should run before they can be assumed to be stuck.
- It is to be run asynchronously.
- It requires multiple activations to complete its processing.
- It is long-lived.
- It involves external interaction—for example, user input.