Introducing Apama Java API concepts
This section introduces the main concepts behind programming the functionality within Apama using Java. It describes how events are modeled in Java and how they are used to drive and trigger listeners within Java 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 Java, 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 Java 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 Java, a developer must write their application as a set of Java classes that implement the Apama Java APIs. This programming model is very similar to writing Enterprise Java Beans 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 Apama Java 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 Apama Java 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.
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.