Apama 10.3 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Getting Started with Apama EPL | Introduction to Apama Event Processing Language
Introduction to Apama Event Processing Language
EPL is a flexible and powerful "curly-brace", domain-specific language designed for writing programs that process events. In EPL, an event is a data object that contains a notification of something that has happened, such as a customer order was shipped, a shipment was delivered, a sensor state change occurred, a stock trade took place, or myriad other things. Each kind of event has a type name and one or more data elements (called fields) associated with it. External events are received by one or more adapters, which receive events from the event source and translate them from a source-specific format into Apama's internal canonical format. Derived events can be created as needed by EPL programs.
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. The EPL programs that process these events are 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 a listener detects an event of interest, it triggers a particular action. If there are no listeners for an event, the correlator either discards it or passes it to a listener specifically for events that have no handler. A monitor instance processes events on one correlator and can send events to communicate with other monitors on the same correlator or remote correlators.
Queries are scalable across multiple correlators. An Apama query operates on only the input event types you specify and you can filter which instances of those events should be processed. Apama partitions these incoming events according to a key field that you specify, for example, there might be a partition for each credit card number. The query processes the events in each partition independently of the events in every other partition. As events are added to partitions, the query checks for a set of events that matches the event pattern you specified, which can optionally specify complex conditions for there to be a match. When a match is found the query executes procedural code that you have defined, which can include sending events.
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, the correlator executes code only in response to events.
The correlator is capable of looking for hundreds of thousands of different events or different event patterns concurrently. When you write an EPL application, you write a set of monitors and/or one or more queries and then you inject or load them into a running correlator. As streams of events pass into a correlator, the monitors and their listeners and/or the queries watch for the events or patterns of events that you have specified as being of interest. There are a variety of actions that you can specify that you want the correlator to perform when a listener or query detects an event or event pattern of interest. For example, the most common action for a monitor is to generate and dispatch a message to an external receiver.
EPL is case-sensitive.

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.