Apama Documentation : Developing Apama Applications : Developing Apama Applications in EPL : Getting Started with Apama EPL : Working with events : Making event type definitions available to monitors and queries
Making event type definitions available to monitors and queries
A monitor or query must have information about the type definitions of the events that it processes. You can provide this information as follows:
*Define the event type in a separate file that contains only event definitions. An event type definition file has a .mon extension. It is still an EPL file even though it contains only event type declarations.
You can define any number of event types in a single file. A common practice is to define the event interface to a service in a file that is separate from the implementation of that service. You might have a single event interface file and multiple implementations of services that process those event types.
An event type definition file is the only way to make event type definitions available to queries.
*Define the event type in the monitor. Only instances of that monitor can process events of that type. Also, events of that type cannot be sent into the correlator from outside. When you define an event type inside a monitor it has a fully qualified name. For example:
monitor Test
{
event Example{}
}
The fully qualified name for the Example event type is Test.Example and the toString() output for the event name is "Test.Example()".
*After the optional package specification, define the event type at the beginning of an EPL file that also defines monitors. All event type declarations must be before the monitor declarations. After you inject this file into the correlator, the following monitors can process events of that type:
*All monitors that you define in the same file
*All monitors that you inject after you inject the file that contains the event definition.
You might have a need for different event type definitions to have the same event type name. In this situation, define each event type in a different package. Remember that event types to be used by queries must be defined in event type definition files. Then, in your monitor or query, use one of the following ways to make the appropriate event type definition available. In the monitor or query:
*Specify the fully qualified name of the event type, for example:
com.apamax.test.Status
*After any package declaration and before any other declarations, specify a using declaration. For example:
using com.apamax.test.Status;
In your code, you can then simply refer to the Status event type.
Do not create EPL structures in the com.apama namespace. This namespace is reserved for future Apama features. If you inadvertently create an EPL structure in the com.apama namespace, the correlator might not flag it as an error in this release, but it might flag it as an error in a future release.
See also Name Precedence.
An event type definition must be injected into the correlator before a monitor that processes events of that type. After you inject an event type definition into the correlator, any monitor that you inject after that can process events of that type.
During development, when you use Software AG Designer to launch a project, it ensures that files are injected in the right order. When more than one project requires the same event definition file, do one of the following:
*In each project, declare an external dependency on the common event definition file:
1. In Software AG Designer, in the Apama Developer perspective, in the Developer Project View, select the project name.
2. Press Alt-Enter.
3. Select MonitorScript Build Path.
4. Click the External Dependencies tab.
5. Click Add External.
6. Navigate to the event type definition file, and select it.
7. Click Open.
*Create a project that contains the common event definition file. In each project that requires these event definitions, declare a dependency on the project that contains the common event definition file.
1. Create the project that contains the common event type definition file and keep that project open in Software AG Designer.
2. In the Developer Project View, select the name of a project that needs to use the common event definition file.
3. Press Alt-Enter.
4. Select MonitorScript Build Path.
5. Select the Projects tab.
6. Click Add.
7. Select the project that contains the event definition file, and click OK.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback