Apama 10.15.4 | Developing Apama Applications | Developing Apama Applications in Java | Overview of Apama JMon Applications | About event types
 
About event types
 
Simple example of an event type
Extended example of a JMon event type
Comparing JMon and EPL event type parameters
About event parameters that are complex types
Non-null values for non-primitive event field types
Apama events are strongly typed. Each event must be of a specific known type, henceforth called the event type. An event type defines the name of the event, and its particular set of parameters. Every parameter is named and can be one of a selection of types. Every event instance of a given event type is therefore identical in structure; every instance has the same set (and order) of parameters.
Before the correlator can understand and process events of a specific event type, it needs to have been provided with an event type definition. This allows it to understand the event messages it is passed, create optimal indexing structures, and allows listeners to be set up to look for event sequences involving events of that type.
An event type definition defines the event type's name and the name, type and order of each of its parameters. Parameters can be of any of the following types:
*Java standard types String, long, double, boolean or Map.
*Java arrays.
*com.apama.jmon.Location type — This type corresponds to either a spatial point represented by two coordinates, or a rectangular space expressed in terms of its two bounding corners.
Apama's JMon API supports Java generic maps. Apama recommends that you use these when possible instead of the Event.getMapFieldTypes() method. Doing so lets you gain the benefits of compile-time type safety as well as a simpler class definition.
However, while it is valid to declare a parameter to be an array of generic maps, assignment of values to the map elements is not type-safe, and will be rejected by the Java compiler. If you need a parameter that is an array of maps, use the Event.getMapFieldTypes() method instead of generic maps.
You can nest a plain Map as a value (not a key) at any depth in a parameterized Map. You cannot nest a parameterized Map in a plain Map. This is because you would not be able to specify the parameterized types to be returned from the getMapFieldTypes() method. Of course, you can nest a parameterized Map as a value (but not a key) in a parameterized Map. For example:
EPL:
event BadComplexEventExample {
   dictionary <string , dictionary <string, SimpleEvent>> complex;
}
Java:
import java.util.Map;
import java.util.HashMap;
import com.apama.jmon.Event;
public class BadComplexEventExample extends Event {
// By using a non-parameterized map you lose the information that the
// field is a dictionary with values that are also dictionaries.
public Map complex;

public BadComplexEventExample() {
this(new HashMap());
}

public BadComplexEventExample(Map complex) {
this.complex = complex;
}
}
See also the definition of ComplexEvent in About event parameters that are complex types.
An event can embed an event (potentially of a different type) as a parameter.