About monitors
Monitor classes configure the activity of the correlator. This is analogous to how an Enterprise JavaBean effectively defines the activity of an application server.
All monitor classes must implement the com.apama.jmon.Monitor interface and define an onLoad method. When a monitor class is loaded into the correlator, it is instantiated as an object and its onLoad method is executed. In Java parlance, this would be equivalent to the static void main (args[]) method.
Most Java code (with certain limitations) can be executed within the onLoad method, although its primary purpose is probably to configure one or more asynchronous listeners for specific events or event sequences.
A monitor class must define a no argument constructor. The Java code within the correlator uses this when the class definition is loaded.
Below is a minimal monitor:
import com.apama.jmon.*;
public class Simple implements Monitor {
/**
* No argument constructor used by the jmon framework on
* application loading
*/
public Simple() {}
/**
* Implementation of the Monitor interface onLoad method.
* Does nothing.
*/
public void onLoad() {
}
}
The above monitor class does nothing and is shown here as a template for how to define a monitor class.
EPL. Although there are similarities, the concept of a monitor in EPL and in JMon is not the same. The EPL monitor is a very powerful custom programming structure, whereas in JMon a monitor class is primarily a standard Java class with an entry method that gets automatically executed upon loading (as described in the topics below).