Developing Apama Applications > Developing Apama Applications in EPL > Defining Monitors
Defining Monitors
A monitor is one of the basic units of EPL program execution.
Note: The other basic unit is a query. A monitor cannot contain a query. A query cannot contain a monitor. For information about writing queries, see Defining Queries. For a comparison of queries and monitors, see Architectural comparison of queries and monitors.
Monitors have both data and logic. Monitors communicate by sending and receiving events. You define a monitor in a .mon source file. When you load the .mon file into the correlator, the correlator creates an instance of the defined monitor.
A monitor instance can operate like a factory and spawn additional monitor instances. A spawned monitor instance is a duplicate of the monitor instance that spawned it except that the correlator does not clone any active listeners or stream queries. Spawning lets a single monitor instance generate multiple instances of itself. While generally, the spawned monitor instances all listen for the same event type, each one can listen for events that have different values in particular fields.
It is good practice to define monitors and events in separate files. An advantage of doing this is that queries, as well as monitors, can use the same event definitions. When you inject files into the correlator, be sure to load event type definitions before you load the monitors and/or queries that process events of those types.
The following topics provide information and instructions for defining monitors. For reference information, see Monitors. Apama provides several sample monitor applications, which you can find in the samples\monitorscript directory of your Apama installation directory.
*About monitor contents
*Example of a simple monitor
*Spawning monitor instances
*Communication among monitor instances
*About service monitors
*Subscribing to channels
*Adding service monitor bundles to your project
*Utilities for operating on monitors
See also: Overview of Developing Apama Applications and Overview of Deploying Apama Applications.
Copyright © 2013-2015 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.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.