Introducing JMon API concepts
This section introduces the main concepts behind programming the functionality within Apama using JMon. It describes how events are modeled in JMon and how they are used to drive and trigger listeners within JMon monitor classes.
Apama is designed to fit within an event (or message) driven world. In event driven systems information is propagated through units of information termed events or messages. Conceptually, an event typically represents an occurrence of a particular item of interest at a specific time, and is usually encoded as an asynchronous network message.
Apama is designed to process thousands of these event messages per second, and to sift through them for sequences of interest based on their contents as well as their temporal relationships to each other. When writing Apama applications using JMon, the Java code you write informs the correlator of the sequences of interest and, when matching event sequences are detected, these are passed to your JMon code for handling. Apama’s correlator component is capable of looking for hundreds of thousands of different event sequences concurrently.
In order to program the correlator using JMon, a developer must write their application as a set of Java classes that implement the JMon APIs. This programming model is similar to writing Enterprise JavaBeans intended for use in an application server. These Java classes then need to be loaded (or ‘injected’) into the correlator, which instantiates and executes them immediately.
Almost all of the standard language functionality provided by Java and its libraries can be used in JMon applications, just as in any other Java applications. However, the power of the correlator is only truly leveraged by invoking its event matching, correlation and event generation capabilities. As streams of events are passed into a correlator, the listeners defined in JMon applications sift through the events looking for specific sequences of interest matching a variety of temporal constraints. Once a listener triggers, a method is invoked on a Java object, the Match Listener object. The developer specifies this object when the listener is created.
Three kinds of Java class objects can be loaded into the correlator; event types, monitors and match listeners.
Event type classes serve to define the event types that the correlator can accept from external sources and carry out correlations on.
Monitor classes program the correlator. They define what event patterns the correlator must look for and allow arbitrary Java code to be executed.
Match listeners provide a method that is called when a specific event sequence is detected.
These three Java class types will be now be discussed in detail.