Apama 10.3 | Apama Documentation | Introduction to Apama | Apama Architecture | Descriptions of Apama components | Description of event processing languages | Introduction to Apama in-process API for Java (JMon)
Introduction to Apama in-process API for Java (JMon)
EPL was designed specifically for event processing. However, some organizations and individuals prefer to use a mainstream programming language, such as Java. Consequently, Apama has made the features of the correlator available in Java.
The correlator uses its embedded Java virtual machine (JVM) to execute JMon monitors. The following Java code defines the StockTick event type.
import com.apama.jmon.Event;
public class StockTick extends Event {
   public String symbol;
   public double price;
   public double volume;
   //No argument constructor
   public StockTick() {
   public StockTick(String name, double price, double volume) {
      this.name = name;
      this.price = price;
      this.volume = volume;
In JMon, an event class definition must include the following:
*A set of public variables to hold the event's fields
*A no-arguments constructor
*A parameterized constructor
While this is not as concise as EPL, these are familiar Java conventions.
The following code defines a JMon monitor that listens for any IBM stock tick events with a price that is greater than 75.5. The onLoad() method creates an event expression object, which receives an Apama event string. This string represents the event to listen for. Also, the PriceCheck class implements the MatchListener class, which provides a match() method to be invoked if the correlator finds a match. This is passed to the event expression object as well.
import com.apama.jmon.*;
public class PriceCheck implements Monitor, MatchListener {
   public PriceCheck() {}
   public void onLoad() {
      EventExpression eventexpr =
         new EventExpression("StockTick(\"IBM\",>75.5,*)");
   public void match(MatchEvent event) {
      System.out.println("Pattern detected");

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.