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
How to Feed Data into the Avaya Event Processor (cont'd)

Using an Event Definition to Identify Athletics News Stories
The event definitions are where the magic happens. The event definitions monitor the streams and take action when they find the desired information. Remember, events are just pieces of data; the event definitions are the actual rules being evaluated inside the Event Processor engine. In our case, we want to monitor the SF_Gate_Stories stream as it receives news stories from the San Francisco Chronicle RSS feed. We need to create an event definition to monitor the SF_Gate_Stories stream and identify stories from the Athletics beat writers. Once we identify a story, we will insert it into the Athletics_News stream along with additional writer data that we retrieve from the Writer_Data data provider.

To create a new event definition, complete the following steps:

  1. Click Edit > New Event Definition from the EPL menu.
  2. Enter MLB_News as the Namespace and Submit_Athletics_Story as the Name. Click OK.
  3. In the Event Definition property window, click the Event Definition tab and enter the text in Listing 3.
  4. Check the Enabled checkbox
  5. Click File > Save System from the EP Studio menu to save the EPL.

Listing 3. The EPL for the Submit_Athletics_Story Event Definition

ON
    MLB_News:SF_Gate_Stories
WHEN
    SF_Gate_Stories.Author = 'Susan Slusser' OR SF_Gate_Stories.Author = 'John Shea'  
    OR SF_Gate_Stories.Author = 'sslusser@sfchronicle.com' OR  
    SF_Gate_Stories.Author = 'jshea@sfchronicle.com'
THEN
  MLB_News:Athletics_News.INSERT(MLB_News:SF_Gate_Stories.Title,
  MLB_News:SF_Gate_Stories.Author,MLB_News:SF_Gate_Stories.Category,
  MLB_News:SF_Gate_Stories.Description,MLB_News:SF_Gate_Stories.Link,
  Writer_Data[SF_Gate_Stories.Author].Email,Writer_Data[SF_Gate_Stories.Author].Blog,
  Writer_Data[SF_Gate_Stories.Author].Organization),
  PRINT('' + MLB_News:SF_Gate_Stories.Title + ' '  + 
    Writer_Data[SF_Gate_Stories.Author].Author + ' '  + 
    Writer_Data[SF_Gate_Stories.Author].Email +' '  + 
    Writer_Data[SF_Gate_Stories.Author].Organization)

This event definition monitors the SF_Gate_Stories stream. As SF_Gate_Stories receives information, this event will review each new item checking if the author matches any of the writers contained in the Writer_Data data provider. If the event definition finds a matching item, it inserts the news story into the Athletics_News stream.

While inserting a story, the event definition also inserts additional author details from the Write_Data data provider. All that is required is to pass the value of the Author field from the SF_Gate_Stories stream item to the Writer_Data data provider.

Testing the Scenario
With all the pieces in place, once you save your work we are ready to start the EP Server and test our Baseball News Service. You can start the EP server by clicking the Start Server icon available in the Event Processor programs group (Start > Programs > Event Processor). After the server completes its initialization routine, you should click the EP Console icon to open the console in your web browser.

When the console page displays, click the Streams link and then click the Athletics_News Stream. If all goes well, you should see something resembling Figure 4.

Figure 4. Athletics News Stories Combined with Author Data.

Summary
This sample application shows how quickly you can begin to integrate external information sources into your EP applications. By combining disparate sources of information, you can build applications that provide powerful new insights to your information while also pushing the information to your users or other applications.

More Resources

Previous Page: Create the Streams  
Ty Anderson is a partner at Cogent Company, a Microsoft-based consultancy in Dallas that helps organizations use Microsoft technologies to grow their business. Ty is a regular contributor to Devx.com, wrote Office Programming 2003: Real World Applications (Apress), and loves to wear his yellow A's hat.
Page 1: Extending the MLB News ScenarioPage 3: Using an Event Definition
Page 2: Create the Streams 



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