public interface PlugInEventRepresentation
A plug-in event representation can be useful when your application has existing Java classes that carry event metadata and event property values and your application does not want to (or cannot) extract or transform such event metadata and event data into one of the built-in event representations (POJO Java objects, Map or XML DOM).
Further use of a plug-in event representation is to provide a faster or short-cut access path to event data. For example, the access to XML event data through a StAX Streaming API for XML (StAX) is known to be very efficient.
Further, a plug-in event representation can provide network lookup and general abstraction of event typing and event sourcing.
Before use, an implementation of this interface must be registered via configuration. Upon engine initialization,
the engine invokes the init(com.espertech.esper.plugin.PlugInEventRepresentationContext)
method passing configuration information.
When a plug-in event type name is registered via configuration (runtime or configuration time), the
engine first asks the implementation whether the type is accepted via acceptsType(com.espertech.esper.plugin.PlugInEventTypeHandlerContext)
.
If accepted, the engine follows with a call to getTypeHandler(com.espertech.esper.plugin.PlugInEventTypeHandlerContext)
for creating and handling the type.
An implementation can participate in dynamic resolution of new (unseen)
event type names if the application configures the URI of the event representation, or a child URI (parameters possible) via
ConfigurationOperations.setPlugInEventTypeResolutionURIs(java.net.URI[])
.
Last, see EPRuntime.getEventSender(java.net.URI[])
. An event sender
allows dynamic reflection on an incoming event object. At the time such an event
sender is obtained and a matching URI specified, the acceptsEventBeanResolution(com.espertech.esper.plugin.PlugInEventBeanReflectorContext)
method
indicates that the event representation can or cannot inspect events, and the PlugInEventBeanFactory
returned is used by the event sender to wrap event objects for processing.
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsEventBeanResolution(PlugInEventBeanReflectorContext acceptBeanContext)
For use with
EPRuntime.getEventSender(java.net.URI[]) ,
returns true if the event representation intends to provide event wrappers for event objects passed in. |
boolean |
acceptsType(PlugInEventTypeHandlerContext acceptTypeContext)
Returns true to indicate that the event representation can handle the requested event type.
|
PlugInEventBeanFactory |
getEventBeanFactory(PlugInEventBeanReflectorContext eventBeanContext)
For use with
EPRuntime.getEventSender(java.net.URI[]) ,
returns the factory that can inspect event objects and provide an event EventBean
wrapper. |
PlugInEventTypeHandler |
getTypeHandler(PlugInEventTypeHandlerContext eventTypeContext)
Returns the event type handler that provides the event type and, upon request, event sender, for this type.
|
void |
init(PlugInEventRepresentationContext eventRepresentationContext)
Initializes the event representation.
|
void init(PlugInEventRepresentationContext eventRepresentationContext)
eventRepresentationContext
- URI and optional configuration informationboolean acceptsType(PlugInEventTypeHandlerContext acceptTypeContext)
Called when a new plug-in event type and name is registered and the its resolution URI matches or is a child URI of the event representation URI.
Also called when a new EPL statement is created with an unseen event type name and the URIs for resolution have been configured.
acceptTypeContext
- provides the URI specified for resolving the type, and configuration info.PlugInEventTypeHandler getTypeHandler(PlugInEventTypeHandlerContext eventTypeContext)
eventTypeContext
- provides the URI specified for resolving the type, and configuration info.boolean acceptsEventBeanResolution(PlugInEventBeanReflectorContext acceptBeanContext)
EPRuntime.getEventSender(java.net.URI[])
,
returns true if the event representation intends to provide event wrappers for event objects passed in.acceptBeanContext
- provides the URI specified for resolving the event object reflectionPlugInEventBeanFactory getEventBeanFactory(PlugInEventBeanReflectorContext eventBeanContext)
EPRuntime.getEventSender(java.net.URI[])
,
returns the factory that can inspect event objects and provide an event EventBean
wrapper.eventBeanContext
- provides the URI specified for resolving the event object reflection