The Avaya Event Processor (EP) changes the way you look at the information flow within your organization. Using the concepts of data streams, I/O Adapters and Data Providers, EP Server allows you to feed data from disparate sources and combine them using the Event Processing Language (EPL) to create new views on different information sources. In a previous article, I explained how to build a simple EP application. In this article, I'll show you how to extend the scenario by accessing multiple information stores, such as RSS feeds, to read data into an EP application. The scenario is similar to last time in that we will build a baseball news service. But instead of tracking news related to a single player, we will monitor a news feed from the newspaper that covers my favorite team, the Oakland Athletics.
Extending the MLB News Scenario
EP supports several methods for reading data into Stream objects. Perhaps the simplest is a comma-separated value (CSV) file that can serve as a type of sequential data file. On the more complex end of the spectrum, EP also supports any JMS, MQ, Web Services and JDBC compliant database (i.e. Oracle, SQL Server, DB2, & MySQL). And if the built in collection of I/O Adapters and Data Providers doesn't meet your needs, Avaya provides an SDK so you can code your own. Given the popularity of RSS today, it is no surprise that Avaya has written a custom I/O adapter to read an RSS feed and fill an EPL stream with the information in the feed.
In EPL, there are two types of data sources: "Push" sources, and "Pull" sources. "Push" sources refer to data that is time-sensitive, and needs to be reacted to on the fly. Examples of these are the familiar stock ticker, and RSS feeds (which are used in this example). Contrasting this are "Pull" data sources—data that are more or less static, as in a disk file or an RDBMS. Sure, they may be updated from time to time, but those updates are rather infrequent. Examples of these include a company database that may relate the stock ticker symbol to the company name, address, industry sector, number of employees, etc.; another example would be a database containing the roster of each MLB team, their past statistics, etc. "Push" data is inserted into the Event Processor as Streams, using I/O adapters. "Pull" data is used in EPL through the mechanism of "Data Providers".
Sometimes, it is necessary to create Streams from data that is stored on a disk, as opposed to information being produced in memory by an application, or coming via a network connection from an external source. This may seem to contradict the point made in the preceding paragraph, but there are good practical reasons for doing so. For example, you may want to create a simulated data stream for debugging purposes, which will feed the same data during each run. The CSV Stream Provider in the Event Processor was created for exactly such an application. Another example would be the case where the data source does not provide a direct interface to get streaming data, but instead writes to a log file. A stream may then be constructed by "tailing" that file.
No matter what your data source, a strategy exists to read your data into your EP application. If EPL does not have a class that supports your data type, and you don't want to create your own custom I/O adapter using their SDK, you could always export your data to a CSV file and use EPL's CSV classes to read the information.
Figure 1 illustrates our extended scenario for baseball news service. We will rely on two data sources to pump data into our EP application. The first is a CSV file that contains information for the Oakland Athletics beat writers from the San Francisco Chronicle. The second is an Athletics RSS feed from the San Francisco Chronicle.
The EP Stream Provider monitors and fetches data from the RSS feed, using the Submit_Athletics_Story event definition to insert new stories into the Athletics_News stream. You should realize that events do not insert themselves into streams, but rather the event definition is used to move these events themselves forward. If the story was authored by one of the writers in the Writer_Data CSV file, the event inserts the news story into the Athletics_News stream while also including additional author data elements retrieved from the Writer_Data file. You can see an example of both Stream Provider and Data Provider interfaces in Figure 1.
 | |
| Figure 1. Logical flow of the Baseball News Service. |