Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: adding an eql example
Wiki Markup
h2. Esper

The Esper component supports the [Esper Library|http://esper.codehaus.org] for Event Stream Processing. The *camel-esper* library is provided by the [Camel Extra|http://code.google.com/p/camel-extra/] project which hosts all *GPL related components for Camel.

h3. URI format

{code}
esper:name[?options]
{code}

When consuming from an Esper endpoint you must specify a *pattern* or *eql* statement to query the event stream.

ForPattern example:

{code}
from("esper://cheese?pattern=every event=MyEvent(bar=5)")
  .
	to("activemq:Foo");
{code}

EQL example:
{code}
from("esper://esper-dom?eql=insert into DomStream select * from org.w3c.dom.Document")
  .to("log://esper-dom?level=INFO");
from("esper://esper-dom?eql=select childNodes from DomStream")
  .to("mock:results");
{code}

h3. Options
{div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{pattern}} |  | The [Esper Pattern expression|http://esper.codehaus.org/esper-14.1110.0/doc/reference/en-US/html/event_patterns.html] as a String to filter events |
| {{eql}} |  | The [Esper EQL expression|http://esper.codehaus.org/esper-14.1110.0/doc/reference/en-US/html/eqlepl_clauses.html] as a String to filter events |
{div}

You can append query options to the URI in the following format, {{?option=value&option=value&...}}

h3. EsperMessage

From *Camel 2.12* onwards the esper consumer stores new and old events in the {{org.apacheextras.camel.component.esper.EsperMessage}} message as the input [Message] on the [Exchange]. You can get access to the esper event beans from java code with:

{code}
    EventBean newEvent = exchange.getIn(EsperMessage.class).getNewEvent();
    EventBean oldEvent = exchange.getIn(EsperMessage.class).getOldEvent();
{code}

By default if you get the body of {{org.apacheextras.camel.component.esper.EsperMessage}} it returns the new {{EventBean}} as in previous versions.

h3. Demo

There is a [demo which shows how to work with ActiveMQ, Camel and Esper|http://code.google.com/p/camel-extra/wiki/EsperDemo] in the [Camel Extra|http://code.google.com/p/camel-extra/] project

{include:Endpoint See Also}
* [Esper Camel Demo|http://code.google.com/p/camel-extra/wiki/EsperDemo]