Skip to content

Swissbanker/esperr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esperr: Stream processing for R

The esperr package for R incorporates the Esper framework and implements an
R-language interface to its XML and Java bean event API. Events are defined by
Java objects or by XML documents that follow an XML schema definition (XSD)
document. The package includes example schema and events.

Esper stream processing applications all follow this basic program:

1. Setup the engine with an event schema XML string
2. Create R event listener callback functions
3. Create EP statement(s)
4. Register event listener functions with the statement(s)
5. Start sending events.


R Example:

require('esperr')

# Configure Esper to use the sample schema. An event schema is required.
# The 'Sensor' parameter is the document root node name (also required).
schema <- paste(system.file(package='esperr'),"/schema/sensor.xsd",sep='')
esperSchema(schema,'Sensor')

# The sensorXMLEvent represents an example event
data(sensorXMLEvent)
cat(sensorXMLEvent)

# Construct a sample stream query statement.
s <- esperStatement('select ID,Observation.Command from MyEvents')

# Define an R event-handling function. The function will be called
# whenever an event meets the query criteria.
f <- function(event) {
  id <- getEventString(event, 'ID')
  command <- getEventString(event,'Observation.Command')
  cat('The event ID property is: ',id,'\n')
  cat('The event Oservation.command property is: ',command,'\n')
  rm(event)
}

# Register the event-handler function with the query statement.
registerEventListener(s,'f')

# Note that Esper supports multiple simultaneous query statements, each
# supporting multiple event handlers. Event handler functions may be
# registered more than once, and with multiple statements as well.

# Finally, send an example event that satisfies the query statement and
# triggers the event handler.

sendEvent(sensorXMLEvent)

This package contains Esper components Copyright (C) 2008 EsperTech, licensed
under the GPL v2.

/ ***************************************************************************** 
 * Copyright (C) 2008 EsperTech, Inc. All rights reserved. 
 * http://esper.codehaus.org 
 * http://www.espertech.com 
 * ------------------------------------------------------------------- *
 * The software in this package is published under the terms of the GPL license
 * a copy of which has been included with this distribution in the license.txt
 * file.
 *****************************************************************************/

Releases

No releases published

Packages