|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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. |
EventSender |
getEventSender(String eventTypeAlias)
Returns a facility to process event objects that are of a known type. |
EventSender |
getEventSender(URI[] uris)
For use with plug-in event representations, returns a facility to process event objects that are of one of a number of types that one or more of the registered plug-in event representation extensions can reflect upon and provide an event for. |
long |
getNumEventsEmitted()
Number of events emitted over the lifetime of the event stream processing runtime, or since the last resetStats() call |
long |
getNumEventsReceived()
Number of events received over the lifetime of the event stream processing runtime, or since the last resetStats() call |
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 |
resetStats()
Reset number of events received and emitted |
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 |
---|
void sendEvent(Object object) throws EPException
Use the route method for sending events into the runtime from within UpdateListener code.
object
- is the event to sent to the runtime
EPException
- is thrown when the processing of the event lead to an errorvoid sendEvent(Map map, String eventTypeAlias) throws EPException
Use the route method for sending events into the runtime from within UpdateListener code.
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
EPException
- - when the processing of the event leads to an errorvoid sendEvent(Node node) throws EPException
Use the route method for sending events into the runtime from within UpdateListener code.
node
- is the DOM node as an event
EPException
- is thrown when the processing of the event lead to an errorlong getNumEventsReceived()
long getNumEventsEmitted()
void resetStats()
void emit(Object object)
object
- to be emitted to the default channelvoid emit(Object object, String channel)
object
- to be emittedchannel
- channel to emit the object to, or null if emitting to the default channelvoid addEmittedListener(EmittedListener listener, String channel)
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 channelsvoid clearEmittedListeners()
void route(Object event)
event
- to route internally for processing by the event stream processing runtimevoid setUnmatchedListener(UnmatchedListener listener)
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
select * from MyEvent(quantity > 5)
For patterns, if no pattern sub-expression is active for such event, the event is also unmatched.
listener
- is the listener to receive notification of unmatched events, or null to unregister a
previously registered listenerObject getVariableValue(String variableName) throws VariableNotFoundException
variableName
- is the name of the variable to return the value for
VariableNotFoundException
- if a variable by that name has not been declaredMap<String,Object> getVariableValue(Set<String> variableNames) throws VariableNotFoundException
variableNames
- is a set of variable names for which to return values
VariableNotFoundException
- if any of the variable names has not been declaredMap<String,Object> getVariableValueAll()
void setVariableValue(String variableName, Object variableValue) throws VariableValueException, VariableNotFoundException
variableName
- is the name of the variable to change the value ofvariableValue
- is the new value of the variable, with null an allowed value
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 declaredvoid setVariableValue(Map<String,Object> variableValues) throws VariableValueException, VariableNotFoundException
variableValues
- is the map of variable name and variable value, with null an allowed value
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 declaredEventSender getEventSender(String eventTypeAlias) throws EventTypeException
Given an event type alias this method returns a sender that allows to send in event objects of that type. The event objects send in via the event sender are expected to match the event type, thus the event sender does not inspect the event object other then perform basic checking.
For events backed by a Java class (JavaBean events), the sender ensures that the object send in matches in class, or implements or extends the class underlying the event type for the given event type alias name.
For events backed by a java.util.Map (Map events), the sender does not perform any checking other then checking that the event object indeed implements Map.
For events backed by a org.w3c.Node (XML DOM events), the sender checks that the root element name indeed does match the root element name for the event type alias.
eventTypeAlias
- is the name of the event type
EventTypeException
- thrown to indicate that the alias does not existEventSender getEventSender(URI[] uris) throws EventTypeException
uris
- is the URIs that specify which plug-in event representations may process an event object.
URIs do not need to match event representation URIs exactly, a child (hierarchical) match is enough for an event representation to participate.
The order of URIs is relevant as each event representation's factory is asked in turn to process the event, until the first factory processes the event.
EventTypeException
- thrown to indicate that the URI list was invalid
|
© 2007 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |