Developing Apama Applications > Developing Apama Applications in EPL > Using Correlator Persistence > How the correlator recovers state > Recovery order
Recovery order
When the correlator recovers state from a recovery datastore it does the following in the following order:
1. Recompile and reinject all source except for deleted events and monitors, which are ignored.
2. Restore objects and listeners in persistent monitors. The correlator does not execute any user code in the first two steps. While it sets up listeners, the listeners cannot yet change state.
3. Set currentTime to the currentTime of the last committed snapshot, which might be considerably earlier than the current time of day if the correlator was down for some time before recovering.
4. Initiate execution of any onBeginRecovery() actions on instances of restored events, monitors, and custom aggregate functions in all persistent monitor instances in all contexts. The order of execution of these actions is undefined. See Defining recovery actions.
5. Quiesce — The correlator waits for all events that have been enqueued to a context to be processed, and also waits for any events that are enqueued to a context as a result of those events to be processsed, and so on, until no more events are generated and enqueued to a context. The correlator also does this for spawn...to statements. This is similar to processing all events in all queues. Be careful not to generate an infinite loop of enqueue...to statements.
6. Restore events, clock ticks, pending spawn...to statements, and so on, that were waiting on context queues when the snapshot was taken.
7. Send a single clock tick of the time at which the correlator is recovered, that is, the current time of day. If -XrecoveryTime was set when the correlator was started, the correlator uses that time for the current time of day.
8. Initiate execution of onload() actions in all non-persistent monitors in injection order.
9. Quiesce.
10. Initiate execution of any onConcludeRecovery() actions on instances of restored events, monitors, and custom aggregate functions in all persistent monitor instances in all contexts. The order of execution of these actions is undefined. See Defining recovery actions.
11. Quiesce.
12. Start generating clock ticks.
13. Start taking persistence snapshots.
14. Open the server port. External components can now connect with the correlator, for example, IAF, engine_send, and engine_receive.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.