Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Exploring Event Driven Architectures with Esper

Exploring Event Driven Architectures with Esper

At Java One Thomas Bernhardt and Alexandre Vasseur explained the concepts of event driven application servers and the Esper project.

Event driven application servers are a new category of servers, proving a runtime and supporting infrastructure services (transport, security, event journaling, high availability, connectors, etc.) to servers designed to be able to process over 100,000 events/sec. As well as event processing, event driven application servers are able to combine event information with long lived historical data (usually obtained via relational database queries) and performing temporal correlation and matching on the event streams.

There are two concepts that make event systems different from messaging system:

  • Event stream processing (ESP) - monitors streams of event data, analyzing those events for matching conditions and then notifies listeners
  • Complex event processing (CEP) - allows the detection of patterns among events

Fully featured application server are still a few years away, but developers can implement event driven architectures in stand alone applications, Java EE applications and Spring applications today using Esper from Codehaus. Esper version 1.0 (as reported by InfoQ) was released in June 2006, and is a lightweight, embeddable open source implementation of both ESP and CEP.

Integrating Esper into stand alone applications is easy. The steps are:

  • Obtain an Esper engine instance
  • Create a statement (using the Esper query language)
  • Register the statement with the engine
  • Create a listener (by implementing a Java interface that will be triggered when the statement evaluates to true) and attach it to the statement

Events can be represented as java objects, XML or maps, and as they flow through the system, statements will be evaluated and listener logic executed.

The Esper query language provides a rich syntax allowing complex temporal logic to be expressed, and includes features such as:

  • Event filtering
  • Sliding window and aggregation (count all assets reported in the last 30 seconds)
  • Grouped windows and output rate limiting (get a count per zone of the last 10 minutes per zone)
  • Joins and outer joins (also joins between event streams)
  • Integration with historic or reference data (accessing relational databases)
  • Creation of virtual streams that all statements can access

Even though event driven application servers are a few years away, Esper is ready for production use today. Integrating Esper into your applications is easy, and will allow you to provide features that will anticipate business and customers needs in real-time.

Rate this Article