Apama 10.3 | Apama Documentation | Developing Apama Applications | EPL Reference | Introduction | Hello World example
 
Hello World example
Though it contains many of the familiar constructs and features found in general-purpose programming languages like Python or Java, EPL also has special features to make it easy to aggregate, filter, correlate, transform, act on, and create events in a concise manner. Here is the canonical "hello world" example written in EPL:
monitor HelloWorld
{
   action onload()
   {
      print "Hello world!";
   }
}
The Apama event processor, called the correlator, receives events of various types from external sources and routes them to one or more active EPL programs, called monitors or queries.
*Monitors have registered event handlers, called listeners, for events of particular types with specific combinations of data values or ranges of values. When the correlator detects an event of interest, it calls the appropriate event handlers. If there are no handlers for an event, the correlator discards it or passes it to an event handler specifically for events that have no handler.
Event handlers in EPL are conceptually similar to methods or functions used for handling user-interface events in other languages, such as Java Swing or SWT applications. In EPL, code is executed only in response to events. Except, that is, for the special EPL onload(), ondie(), and onunload() actions. See Monitor lifecycle for information about these actions.
*Queries define particular event types as input and then partition incoming events of those types according to a specified key. For example, a query might partition bank transactions according to their account numbers. Like a monitor, a query watches for an event pattern of interest, but it does this in each partition independently of every other partition.
When the correlator finds a match, it executes the procedural code specified in the query.

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.