Avaya DevConnect Center
Home IP Communications Contact Centers Unified Communications Communications Enabled Business Processes Avaya DevConnect Portal RSS Feed
Register to join the Avaya DevConnect Program to gain access to Avaya APIs & SDKs, purchase Avaya products for development at discounted prices, and receive a discount on training and certification. More information
Sign up for your free email newsletter today!
Avaya Developer News

More Newsletters
Deep Dive: Avaya Event Processor Offers Familiar Tools for Creating Event-Driven SOA Applications (cont'd)

Using the Event Processing Language
The Avaya EPL is a SQL-like language for issuing queries on moving data streams. It is optimized for time-domain analysis of data. The Avaya EPL consists of three main clauses you can use. The ON clause expresses triggers that constrain when rules will be evaluated. The WHEN clause expresses the actual rule to be evaluated. Finally, the THEN clause expresses the action(s) to be taken when the rule returns a positive match. Every EPL statement must have either an ON or a WHEN clause; it must also always have a THEN clause.

An EPL statement uses Data Providers to access persistent data using the same syntax as streams. EPL functionality uses SQL-like conditions. For example, Logical conditions include AND OR XOR NOT TRUE … Comparison conditions use the standard SQL > < = != <= >=. Math conditions include + - / * % ^ &, and the Grouping condition ( ).

EPL uses time-based analysis via data batches, calendar synchronization and scheduling. EPL also uses aggregation, which includes branch (or fork), for example STOCKS [SYMBOL=*] .MEAN ('PRICE'); asynchronous stream joins; 1:N, N:N joins; and sorting and filtering.

Accessing Streams
Streams are accessed in a way similar to a database table in SQL. Streams have fields, which are equivalent to table columns. In the same way that you would use TABLE.COLUMN in SQL, you access fields in EPL using STREAM.FIELD. This significantly shortens the learning curve of EPL.

Further, every stream can be used for input and output. For example, in the EPL statement in Figure 2, the stream TRADES provides the input and the data for the condition. In the THEN part, the event definition creates new events and pushes them to the ALERTS stream.
Figure 2. Anatomy of an EPL Statement

A stream is defined using an EPL statement, CREATE STREAM with similar syntax to the SQL CREATE TABLE statement. The stream is a tabular data structure, and like an SQL table has named fields with data types. A stream can also accept Java Beans as input. In all cases, the syntax of EPL is identical, for accessing a field within a stream. When doing STREAM.FIELD, you use a JavaBean property. XML streams use XML schema for the stream definition. Again, the same STREAM.FIELD syntax is used to access individual fields within the XML.

Using WHEN
The WHEN syntax is similar to WHERE syntax in SQL. The condition uses multiple streams and views. In the example in Figure 2, the value of AVG_PRICE that is used in the WHEN condition is defined in the ON trigger as an alias to a chain of views applied to a stream.

Using Views
A view is an internal data structure that is built from streams. Views can be chained to each other, and create complex sequences of data processing. For example in Figure 2, a TRADES stream can be connected to a chain of three views, with each creating a new view of the data in the stream. The resulting view is named using a shortcut, AVG_PRICE. This new alias is used in other parts of the EPL statement. We use AVG_PRICE in the WHEN condition and the INSERT in the THEN clause.

Using Functions
Functions provide simple operations. For example, the TIME function in Figure 2 can be used to calculate time in milliseconds. The TIME_WINDOW view requires the size of the window in milliseconds. You can use the TIME function to calculate the window size in milliseconds in a more readable way.

Using Data Providers
Data providers offer access to persistent data. The syntax for using a data provider is identical to the stream syntax. For example in Figure 2, the STOCKS_DATA data provider can be mapped to a database table. You can access it by primary key, and access fields using the dot syntax, similar to streams.

Creating Data Schemas for Event Streams
The Event Server supports multiple data schemas for event streams. The common data schema is the first one, which simply defines the stream as a list of fields with data types. This syntax is similar to a database table definition and is the most common.

A stream can also use Java Beans for event data. A stream that uses Java Beans does not need to specify the list of fields and their types. They are already defined in the Bean. Using this method an application sends Java objects directly to the event server with no additional data mapping and integration.

You can define a stream by an XML schema. Access to the stream data in an event definition is identical, regardless of the schema of the stream.

Data providers are defined in a similar way, plus additional configuration parameters that are required to connect the data provider to an underlying data source. The data provider configuration contains the configuration properties, as well as the data schema for the data provider.

Previous Page: Using the Event Processor Server Next Page: Using EPL Studio
Page 1: Using the Event Processor ServerPage 3: Using EPL Studio
Page 2: Using the Event Processing Language 



JupiterOnlineMedia

internet.com earthweb.com Devx.com mediabistro.com Graphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers