Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Defining Monitors | Spawning monitor instances | About executing ondie() actions
About executing ondie() actions
A monitor instance can terminate for any of the following reasons:
*It executes all its code and has no active listeners or streaming elements.
*It executes a die statement in one of its actions.
*The engine_delete utility or an Apama client API removes the monitor from the correlator.
*A runtime error is detected in the monitor's code, which causes that instance of the monitor to die.
In all of these situations, if the monitor defines an ondie() action, the correlator invokes it. Like the onload() and onunload() actions, ondie() is a special action because the correlator invokes it automatically in certain situations.
Suppose that a monitor that defines the ondie() action spawns ten times, and each monitor instance dies. The correlator invokes ondie() eleven times: once for each spawned monitor instance, and once for the initial monitor instance. Then, just before the monitor's EPL is unloaded from the correlator, the correlator invokes the onunload()action only once, and it does so in the context of the last remaining monitor instance.
The correlator executes each ondie() operation in the context of its monitor instance. Therefore, the ondie() operation can access the variables in the monitor instance being terminated.
You cannot spawn in an ondie() or an onunload() action.

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.