com.espertech.esper.client
Interface EPRuntime

All Known Implementing Classes:
EPRuntimeImpl

public interface EPRuntime

Interface to event stream processing runtime services.


Method Summary
 void addEmittedListener(EmittedListener listener, String channel)
          Register an object that listens for events emitted from the event stream processing runtime on the specified channel.
 void clearEmittedListeners()
          Deregister all emitted event listeners.
 void emit(Object object)
          Emit an event object to any registered EmittedListener instances listening to the default channel.
 void emit(Object object, String channel)
          Emit an event object to any registered EmittedListener instances on the specified channel.
 int getNumEventsEmitted()
          Number of events emitted over the lifetime of the event stream processing runtime.
 int getNumEventsReceived()
          Number of events received over the lifetime of the event stream processing runtime.
 Map<String,Object> getVariableValue(Set<String> variableNames)
          Returns current variable values for each of the variable names passed in, guaranteeing consistency in the face of concurrent updates to the variables.
 Object getVariableValue(String variableName)
          Returns the current variable value.
 Map<String,Object> getVariableValueAll()
          Returns current variable values for all variables, guaranteeing consistency in the face of concurrent updates to the variables.
 void route(Object event)
          Route the event object back to the event stream processing runtime for internal dispatching.
 void sendEvent(Map map, String eventTypeAlias)
          Send a map containing event property values to the event stream processing runtime.
 void sendEvent(Node node)
          Send an event represented by a DOM node to the event stream processing runtime.
 void sendEvent(Object object)
          Send an event represented by a plain Java object to the event stream processing runtime.
 void setUnmatchedListener(UnmatchedListener listener)
          Sets a listener to receive events that are unmatched by any statement.
 void setVariableValue(Map<String,Object> variableValues)
          Sets the value of multiple variables in one update, applying all or none of the changes to variable values in one atomic transaction.
 void setVariableValue(String variableName, Object variableValue)
          Sets the value of a single variable.
 

Method Detail

sendEvent

void sendEvent(Object object)
               throws EPException
Send an event represented by a plain Java object to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code.

Parameters:
object - is the event to sent to the runtime
Throws:
EPException - is thrown when the processing of the event lead to an error

sendEvent

void sendEvent(Map map,
               String eventTypeAlias)
               throws EPException
Send a map containing event property values to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code.

Parameters:
map - - map that contains event property values. Keys are expected to be of type String while values can be of any type. Keys and values should match those declared via Configuration for the given eventTypeAlias.
eventTypeAlias - - the alias for the (property name, property type) information for this map
Throws:
EPException - - when the processing of the event leads to an error

sendEvent

void sendEvent(Node node)
               throws EPException
Send an event represented by a DOM node to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code.

Parameters:
node - is the DOM node as an event
Throws:
EPException - is thrown when the processing of the event lead to an error

getNumEventsReceived

int getNumEventsReceived()
Number of events received over the lifetime of the event stream processing runtime.

Returns:
number of events received

getNumEventsEmitted

int getNumEventsEmitted()
Number of events emitted over the lifetime of the event stream processing runtime.

Returns:
number of events emitted

emit

void emit(Object object)
Emit an event object to any registered EmittedListener instances listening to the default channel.

Parameters:
object - to be emitted to the default channel

emit

void emit(Object object,
          String channel)
Emit an event object to any registered EmittedListener instances on the specified channel. Event listeners listening to all channels as well as those listening to the specific channel are called. Supplying a null value in the channel has the same result as the emit(Object object) method.

Parameters:
object - to be emitted
channel - channel to emit the object to, or null if emitting to the default channel

addEmittedListener

void addEmittedListener(EmittedListener listener,
                        String channel)
Register an object that listens for events emitted from the event stream processing runtime on the specified channel. A null value can be supplied for the channel in which case the emit listener will be invoked for events emitted an any channel.

Parameters:
listener - called when an event is emitted by the runtime.
channel - is the channel to add the listener to, a null value can be used to listen to events emitted on all channels

clearEmittedListeners

void clearEmittedListeners()
Deregister all emitted event listeners.


route

void route(Object event)
Route the event object back to the event stream processing runtime for internal dispatching. The route event is processed just like it was sent to the runtime, that is any active expressions seeking that event receive it. The routed event has priority over other events sent to the runtime. In a single-threaded application the routed event is processed before the next event is sent to the runtime through the EPRuntime.sendEvent method.

Parameters:
event - to route internally for processing by the event stream processing runtime

setUnmatchedListener

void setUnmatchedListener(UnmatchedListener listener)
Sets a listener to receive events that are unmatched by any statement.

Events that can be unmatched are all events that are send into a runtime via one of the sendEvent methods, or that have been generated via insert-into clause.

For an event to be unmatched by any statement, the event must not match any statement's event stream filter criteria (a where-clause is NOT a filter criteria for a stream, as below).

Note: In the following statement a MyEvent event does always match this statement's event stream filter criteria, regardless of the value of the 'quantity' property.

select * from MyEvent where quantity > 5

In the following statement only a MyEvent event with a 'quantity' property value of 5 or less does not match this statement's event stream filter criteria:
select * from MyEvent(quantity > 5)

For patterns, if no pattern sub-expression is active for such event, the event is also unmatched.

Parameters:
listener - is the listener to receive notification of unmatched events, or null to unregister a previously registered listener

getVariableValue

Object getVariableValue(String variableName)
                        throws VariableNotFoundException
Returns the current variable value. A null value is a valid value for a variable.

Parameters:
variableName - is the name of the variable to return the value for
Returns:
current variable value
Throws:
VariableNotFoundException - if a variable by that name has not been declared

getVariableValue

Map<String,Object> getVariableValue(Set<String> variableNames)
                                    throws VariableNotFoundException
Returns current variable values for each of the variable names passed in, guaranteeing consistency in the face of concurrent updates to the variables.

Parameters:
variableNames - is a set of variable names for which to return values
Returns:
map of variable name and variable value
Throws:
VariableNotFoundException - if any of the variable names has not been declared

getVariableValueAll

Map<String,Object> getVariableValueAll()
Returns current variable values for all variables, guaranteeing consistency in the face of concurrent updates to the variables.

Returns:
map of variable name and variable value

setVariableValue

void setVariableValue(String variableName,
                      Object variableValue)
                      throws VariableValueException,
                             VariableNotFoundException
Sets the value of a single variable.

Parameters:
variableName - is the name of the variable to change the value of
variableValue - is the new value of the variable, with null an allowed value
Throws:
VariableValueException - if the value does not match variable type or cannot be safely coerced to the variable type
VariableNotFoundException - if the variable name has not been declared

setVariableValue

void setVariableValue(Map<String,Object> variableValues)
                      throws VariableValueException,
                             VariableNotFoundException
Sets the value of multiple variables in one update, applying all or none of the changes to variable values in one atomic transaction.

Parameters:
variableValues - is the map of variable name and variable value, with null an allowed value
Throws:
VariableValueException - if any value does not match variable type or cannot be safely coerced to the variable type
VariableNotFoundException - if any of the variable names has not been declared

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com