Esper-8

Esper-8 Migrating What is Deprecated

In Esper-8, we removed the runtime configuration API namely ConfigurationOperations and EPAdministrator#getConfiguration. The methods therein duplicated regular configuration and are available using EPL instead.

In Esper-8, we removed timer control events. The TimerEvent class and its subclasses are removed. Please use EPEventService#advanceTime, EPEventService#advanceTimeSpan, EPEventService#clockInternal and EPEventService#clockExternal instead.

In Esper-8, we removed support for revision event types. They were generally superseded by tables and update.

In Esper-8, we removed support for plug-in event representations. Implementing custom event type with a compiler architecture means an event type must be able to generate lots of small pieces of code. And implementing an event type requires a lots of plug-in code before that. The feature seemed un-used also because the existing event types offer all that is needed.

In Esper-8, we removed the the view resources configuration settings "Sharing View Resources Between Statements" and "Multi-Expiry Policy". The former was set to false by default. Named windows already to a way better job at sharing vies. The latter provided compatibility for those migrating from version 3 and was thus outdated.

In Esper-8, we removed support for updating event types and removing event types via API. We plan on being able to update modules. Please contact us if you are interested.

In Esper-8, we removed EsperIO-Stax. EsperIO-Stax was an example for plug-in event representations (see above).

In Esper-8, we removed support for isolated service providers. This feature was limited to non-sharable EPL objects since EPL objects such as named windows or tables were always global.

2019-06-28T17:17:28+00:00Esper-8|

Esper-8 Migrating EPL from Older Versions

There are no EPL changes between Esper-7 and Esper-8 other than as documented below. The execution of EPL is the same between the versions.

URI Use in EPL

Esper-7 allowed the use of the engine-URI to be used as a prefix to the event property name in expressions. Since in Esper-8 the runtime-URI is not available to the compiler the URI cannot be specified any longer as part of an event property expression.

Automated Bean Event Type Registration when the From-Clause Provided a Fully-Qualified Class Name

In Esper-7 when the from-clause or on-clause had a fully-qualified class name Esper-7 would create an event type for the class implicitly. Esper-8 does not automatically create an event type for the from-clause and on-clause. In Esper-8 the from-clause or on-clause must refer to existing event type. You may however register an event type with an event type name that is the fully-qualified class name.

Substitution Parameters

In Esper-7 the type of the substitution parameter was known before EPL query validation since the call to set a value took place before query validation. In Esper-8 the type of the substitution parameter is not known since setting a value takes place at runtime. In Esper-8 the compiler assumes Object-type for substitution parameters in case the EPL does not provide a type. This can cause your EPL to not compile. You can either provide the type of the substitution parameter using ?::type or ?:name:type. Or you can use the cast function to cast to the desired type.

Named Window Subquery Index Sharing

Subquery index sharing for named windows now requires creating an explicit index using create index. In Esper-7 the query planner, when using named window subquery index sharing, would know about indexes already created by other modules. In Esper-8 the compiler does not know implicit indexes created by other modules therefore named window subquery index sharing relies on indexes created using create index only.

2019-06-28T17:17:35+00:00Esper-8|

Esper-8 Migrating Step-By-Step For Existing Applications

The instructions herein are meant to be used together with the remaining material on migrating. They provide an outline for moving an application to Esper 8.

Classpath Changes

Remove CGLib from classpath. Add the Esper compiler, common and runtime jar files and their dependencies.

Configuration Changes

Please see the document on migrating configuration XML and configuration code.

The following settings are for applications that allow subscribers and that rely on the Esper-7 global public visibilities.

The XML configuration is:

<esper-configuration xmlns="https://www.espertech.com/schema/esper">
    <compiler>
		<bytecode
                allow-subscriber="true"
                access-modifier-context="public"
                access-modifier-event-type="public"
                access-modifier-expression="public"
                access-modifier-named-window="public"
                access-modifier-script="public"
                access-modifier-table="public"
                access-modifier-variable="public"
                bus-modifier-event-type="bus"/>
    </compiler>
</esper-configuration>

The code for using the configuration API is:

Configuration configuration = new Configuration();
configuration.getCompiler().getByteCode().setAllowSubscriber(true);
configuration.getCompiler().getByteCode().setAccessModifiersPublic();
configuration.getCompiler().getByteCode().setBusModifierEventType(EventTypeBusModifier.BUS);

By setting the allow-subscriber flag your statement allows subscribers to receive results. Esper-7 allows subscribers by default.

By setting the default access modifiers to PUBLIC all EPL-objects such as event types are publicly visible. Esper-7 has only public visibility.

By setting the bus-modifier for event types to BUS your application can use send-event to send any type of event into the engine. Esper-7 has only bus visibility.

Remove Esper-related Imports from Classes

All package names have changed due to the refactoring into common, compiler and runtime. Please remove all Esper-related imports from the import section of each class.

Classes in com.espertech.esper.client that were common to the compiler and runtime have been moved to com.espertech.esper.common.client, for example EventBean and EventType.

Classes in com.espertech.esper.client that were specific to the runtime have been moved to com.espertech.esper.runtime.client.

Compile-Related Changes

Esper-8 uses a compiler for compiling an EPL module to byte code. The Esper-7 createEPL method has been removed. You could use the utility method shown below for compiling. It returns you a Deployment object. Use deployment.getStatements() to obtain the EPStatement instances.

Here is a method that can replace createEPL calls of Esper-7:

public static EPDeployment compileDeploy(EPRuntime runtime, String epl) {
  try {
    // Obtain a copy of the engine configuration
    Configuration configuration = runtime.getConfigurationDeepCopy();

    // Build compiler arguments
    CompilerArguments args = new CompilerArguments(configuration);

    // Make the existing EPL objects available to the compiler
    args.getPath().add(runtime.getRuntimePath());

    // Compile
    EPCompiled compiled = EPCompilerProvider.getCompiler().compile(epl, args);

    // Return the deployment
    return runtime.getDeploymentService().deploy(compiled);
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}

Here is how to use the method above:

EPDeployment deployment = compileDeploy(runtime, epl);
deployment.getStatements()[0].addListener(...);

Change Listener Code

The StatementAwareUpdateListener interface has been removed. Instead the UpdateListener interface was changed to match the StatementAwareUpdateListener
footprint.

Change Calls to the EPRuntime#sendEvent method

The send-event and route-event methods were moved to the EPEventService interface and were renamed to consistently account for the underlying event object
to be processed. All methods now also require the event type name as a parameter. The new methods are sendEventBean, sendEventMap, sendEventObjectArray,
sendEventXMLDOM and sendEventAvro.

For example:

runtime.getEventService().sendEventBean(new MyEvent(...), "MyEvent");

Change Code That Advances Time

The TimerEvent class is removed and the sendEvent method can no longer be used to advance time. Use EPEventService#advanceTime(time) and EPEventService#clockExternal() instead.

Change Code That Uses the Runtime Configuration API

The ConfigurationOperations interface has been removed. Instead use the Configuration interface or respective service such as EPVariableService.

2019-06-28T17:17:43+00:00Esper-8|

Esper-8 Migrating API Uses From Older Versions

This page provides per-interface information on the API changes. It lists the Esper-7 class name and underneath it lists all removed methods, all changed methods and all new methods. When there were no changes for a method or interface the document does not list the method or interface.

The document lists the key public methods of Esper-7 and does not list extension APIs, software provider (SPI) interfaces and other utility classes.

EPServiceProviderManager

This class has been renamed to EPRuntimeProvider.

Esper-7 Esper-8
EPServiceProvider getDefaultProvider(...) (various footprints) Replaced by EPRuntimeProvider#getDefaultRuntime(...) returning EPRuntime (various footprints)
EPServiceProvider getProvider(...) (various footprints) Replaced by EPRuntimeProvider#getRuntime(...) returning EPRuntime (various footprints)
EPServiceProvider getExistingProvider(String providerURI) Replaced by EPRuntimeProvider#getExistingRuntime returning EPRuntime
String[] getProviderURIs() Replaced by EPRuntimeProvider#getRuntimeURIs

EPServiceProvider

This class has been renamed to EPRuntime.

Esper-7 Esper-8
EPRuntime getEPRuntime() Replaced by EPRuntime#getEventService()
EPAdministrator getEPAdministrator() Replaced by EPRuntime#getDeploymentService()
addServiceStateListener(EPServiceStateListener listener) Replaced by EPRuntime#addRuntimeStateListener
boolean removeServiceStateListener(EPServiceStateListener listener) Replaced by EPRuntime#removeRuntimeStateListener
removeAllServiceStateListeners() Replaced by EPRuntime#removeAllRuntimeStateListeners
addStatementStateListener(EPStatementStateListener listener) Replaced by EPDeploymentService#addDeploymentStateListener
removeStatementStateListener() Replaced by EPDeploymentService#removeDeploymentStateListener
removeAllStatementStateListeners() Replaced by EPDeploymentService#removeAllDeploymentStateListeners
getEPServiceIsolated Removed; Isolated service no longer supported
ReadWriteLock getEngineInstanceWideLock Replaced by ReadWriteLock getRuntimeInstanceWideLock()
New method EPEventService getEventService() returns the event service.
New method EPDataFlowService getDataFlowService() returns the data flow service.
New method EPContextPartitionService getContextPartitionService() returns the context partition admin.
New method EPVariableService getVariableService() returns the variable service.
New method EPMetricsService getMetricsService() returns the metrics service.
New method EPEventTypeService getEventTypeService() returns the event type service.
New method EPRenderEventService getRenderEventService() returns the event rendering service.
New method EPFireAndForgetService getFireAndForgetService() returns the fire-and-forget execution service.
New method EPDeploymentService getDeploymentService() returns the deployment service.
New method getConfigurationDeepCopy returns a copy of the engine's currently-used configuration.
New method getConfigurationTransient returns the transient configuration passed to the engine.
New method getRuntimePath returns EPL-object metadata for use by the compiler.

EPRuntime

This class has been renamed to EPEventService.

Esper-7 Esper-8
sendEvent(Object object) Replaced by EPEventService#sendEventBean(Object event, String eventTypeName)
sendEvent(Map map, String mapEventTypeName) Replaced by EPEventService#sendEventMap(Map<String, Object> event, String eventTypeName)
sendEvent(Object[] objectarray, String objectArrayEventTypeName) Replaced by EPEventService#sendEventObjectArray(Object[] event, String eventTypeName);
sendEvent(org.w3c.dom.Node node) Replaced by EPEventService#sendEventXMLDOM(Node node, String eventTypeName)
route(Object theEvent) Replaced by EPEventService#routeEventBean(Object event, String eventTypeName)
route(Map map, String eventTypeName) Replaced by EPEventService#routeEventMap(Map<String, Object> event, String eventTypeName)
route(Object[] objectArray, String eventTypeName) Replaced by EPEventService#routeEventObjectArray(Object[] event, String eventTypeName)
route(org.w3c.dom.Node node) Replaced by EPEventService#routeEventXMLDOM(Node node, String eventTypeName)
routeAvro(Object avroGenericDataDotRecord, String avroEventTypeName) Replaced by EPEventService#routeEventAvro(Object avroGenericDataDotRecord, String eventTypeName)
long getCurrentTime Replaced by EPEventService#getCurrentTime
Long getNextScheduledTime Replaced by EPEventService#getNextScheduledTime
boolean isExternalClockingEnabled Replaced by EPEventService#isExternalClockingEnabled
New method EPEventService#advanceTime(long time); Replaces sendEvent(new CurrentTimeEvent(time))
New method EPEventService#advanceTimeSpan(long time); Replaces sendEvent(new CurrentTimeSpanEvent(time))
New method EPEventService#advanceTimeSpan(long time, long resolution); Replaces sendEvent(new CurrentTimeSpanEvent(time, resolution))
New method EPEventService#clockInternal(); Replaces sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_INTERNAL))
New method EPEventService#clockExternal(); Replaces sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_EXTERNAL))
EventSender getEventSender(URI[] uris) Removed; Plug-In event representations are no longer supported
getVariableValue(...) (various footprints) Moved to EPVariableService#getVariableValue (various footprints)
getVariableValueAll Moved to EPVariableService#getVariableValueAll
setVariableValue (various footprints) Moved to EPVariableService#setVariableValue (various footprints)
EPOnDemandQueryResult executeQuery(String epl) (various footprints) Moved to EPFireAndForgetService#EPFireAndForgetQueryResult executeQuery(EPCompiled compiled) (various footprints)
EPOnDemandPreparedQuery prepareQuery(String epl) (various footprints) Moved to EPFireAndForgetService#EPFireAndForgetPreparedQuery prepareQuery(EPCompiled compiled) (various footprints)
EPOnDemandPreparedQueryParameterized prepareQueryWithParameters(String epl) Moved to EPFireAndForgetService#prepareQueryWithParameters(EPCompiled compiled)

EPAdministrator

This class has been renamed to EPDeploymentService.

Esper-7 Esper-8
getDeploymentAdmin Removed; Use the deploy and undeploy methods instead.
createEPL, createPattern, create Removed; Use the compiler to compile.
prepareEPL, preparePattern, prepare Removed; Use DeploymentOptions to assign substitution parameters.
EPStatement getStatement(String statementName) Replaced by EPDeploymentService#getStatement(String deploymentId, String statementName).
The deployment id of the statement must be passed as well since the statement name alone is not unique.
String[] getStatementNames() Removed; Use EPDeploymentService#getDeployments to obtain all deployment ids; Use getDeployment to obtain a deployment and its statements.
startAllStatements() and stopAllStatements() and destroyAllStatements() Removed; Use deploy and undeployAll instead.
ConfigurationOperations getConfiguration() Removed; Use EPRuntime#getConfigurationDeepCopy.
getContextPartitionAdmin Removed; Use EPRuntime#getContextPartitionService()
New method Deployment deploy(...) for deploying compiled EPL modules.
New method undeploy(...) for un-deploying deployments.
New method undeployAll(...) for un-deploying all deployments.
New method Deployment getDeployment(String deploymentId) for obtaining deployment information including statements.
New method addDeploymentStateListener(DeploymentStateListener listener) for registering a callback for deployment events.

EPStatement

Esper-7 Esper-8
start() Removed; The lifecycle of a statement follows the EPL deployment. Use EPDeploymentService#deploy instead.
stop() Removed; The lifecycle of a statement follows the EPL deployment. Use EPDeploymentService#undeploy instead.
destroy() Removed; The lifecycle of a statement follows the EPL deployment. Use EPDeploymentService#undeploy instead.
EPStatementState getState Removed; The lifecycle of a statement follows the EPL deployment. Use isDestroyed instead.
boolean isStarted() Removed; The lifecycle of a statement follows the EPL deployment. Use isDestroyed instead.
boolean isStopped() Removed; The lifecycle of a statement follows the EPL deployment. Use isDestroyed instead.
String getText() Removed; Use getProperty(StatementProperty.EPL) instead. This method can return null depending on compiler settings (by default it returns the EPL text).
long getTimeLastStateChange() Removed; The lifecycle of a statement follows the EPL deployment. Obtain the deployment timestamp from Deployment.
boolean isPattern() Removed without replacement.
String getServiceIsolated() Removed without replacement.
String getDeploymentId() New method, returns the deployment id.
Object getProperty(StatementProperty field) New method, returns the statement properties such as EPL text and statement type.
addListener(StatementAwareUpdateListener listener) Removed, use addListener(UpdateListener listener) instead.
removeListener(StatementAwareUpdateListener listener) Removed, use removeListener(UpdateListener listener) instead.
Iterator getStatementAwareListeners() Removed, use getUpdateListeners() instead.

EPContextPartitionAdmin

The class EPContextPartitionAdmin has been renamed to EPContextPartitionService.
Obtain from EPRuntime#getContextPartitionService.

Esper-7 Esper-8
String[] getContextStatementNames(String contextName) EPContextPartitionService#getContextStatementNames(String deploymentId, String contextName) Method now requires the deployment-id of the context.
int getContextNestingLevel(String contextName) EPContextPartitionService#getContextNestingLevel(String deploymentId, String contextName) Method now requires the deployment-id of the context.
ContextPartitionCollection destroyContextPartitions(String contextName, ContextPartitionSelector selector) Removed; Context partition can be destroyed using EPL termination clause.
ContextPartitionCollection stopContextPartitions(String contextName, ContextPartitionSelector selector) Removed; Context partition can be stopped using EPL termination clause.
ContextPartitionCollection startContextPartitions(String contextName, ContextPartitionSelector selector) Removed; Context partition can be started using EPL initiated-by clause.
ContextPartitionCollection getContextPartitions(String contextName, ContextPartitionSelector selector) EPContextPartitionService#getContextPartitions(String deploymentId, String contextName, ContextPartitionSelector selector) Method now requires the deployment-id of the context.
Set getContextPartitionIds(String contextName, ContextPartitionSelector selector) EPContextPartitionService#getContextPartitionIds(String deploymentId, String contextName, ContextPartitionSelector selector); Method now requires the deployment-id of the context.
ContextPartitionDescriptor destroyContextPartition(String contextName, int agentInstanceId) Removed; Context partition can be destroyed using EPL termination clause.
ContextPartitionDescriptor stopContextPartition(String contextName, int agentInstanceId) Removed; Context partition can be stopped using EPL termination clause.
ContextPartitionDescriptor startContextPartition(String contextName, int agentInstanceId) Removed; Context partition can be started using EPL initiated-by clause.
ContextPartitionDescriptor getDescriptor(String contextName, int agentInstanceId) Replaced by EPContextPartitionService#getIdentifier(String deploymentId, String contextName, int agentInstanceId)
Map getContextProperties(String contextName, int contextPartitionId) EPContextPartitionService#getContextProperties(String deploymentId, String contextName, int contextPartitionId) Method now requires the deployment-id of the context.

EPDataFlowRuntime

The class EPDataFlowRuntime has been renamed to EPDataFlowService.
Obtain from EPRuntime#getDataFlowService.

Esper-7 Esper-8
EPDataFlowDescriptor getDataFlow(String dataFlowName) EPDataFlowService#getDataFlow(String deploymentId, String dataflowName) Method now requires the deployment-id of the dataflow.
String[] getDataFlows() EPDataFlowService#getDataFlows() Method now returns the pair of deployment-id and dataflow names.
EPDataFlowInstance instantiate(String dataFlowName) (various footprints) EPDataFlowService#instantiate(String deploymentId, String dataflowName) Method now requires the deployment-id of the dataflow (various footprints).

EPDeploymentAdmin

This class has been superseded by the compiler API and there is no direct replacement.

Esper-7 Esper-8
Module read(...) (various footprints) Replaced by EPCompiler#read
Module parse(String eplModuleText) Replaced by EPCompiler#parseModule
DeploymentOrder getDeploymentOrder(Collection modules, DeploymentOrderOptions options) Replaced by ModuleOrderUtil#getDeploymentOrder
DeploymentResult deploy(...) (various footprints) Replaced by EPCompiler#compile and by EPAdministrator#deploy
UndeploymentResult undeployRemove(String deploymentId) Replaced by EPDeploymentService#undeploy
String[] getDeployments() Replaced by EPDeploymentService#getDeployments
DeploymentInformation getDeployment(String deploymentId) Replaced by EPDeploymentService#getDeployment
DeploymentInformation[] getDeploymentInformation() Replaced by EPDeploymentService#getDeployments and EPAdministrator#getDeployment(String id) instead.
boolean isDeployed(String moduleName) Replaced by EPDeploymentService#getDeployments and EPAdministrator#getDeployment(String id) instead.
DeploymentResult readDeploy(...) (various footprints) Replaced by EPCompiler#read and EPCompiler#compile and EPAdministrator#deploy instead.
DeploymentResult parseDeploy(...) (various footprints) Replaced by EPCompiler#parse and EPCompiler#compile and EPAdministrator#deploy instead.
String add(Module module) (various footprints) Replaced by EPCompiler#compile and EPAdministrator#deploy instead.
DeploymentResult deploy(String deploymentId, DeploymentOptions options) Replaced by EPDeploymentService#deploy instead.
UndeploymentResult undeploy(String deploymentId) (various footprints) Replaced by EPDeploymentService#undeploy instead.

ConfigurationOperations

This class has been superseded by other APIs and by using EPL.

Esper-7 Esper-8
addEventTypeAutoName(String packageName) Replaced by ConfigurationCommon#addEventTypeAutoName instead.
addPlugInAggregationMultiFunction(ConfigurationPlugInAggregationMultiFunction config) Replaced by ConfigurationCompiler#addPlugInAggregationMultiFunction
addPlugInAggregationFunctionFactory(String functionName, String aggregationFactoryClassName) Replaced by ConfigurationCompiler#addPlugInAggregationFunction
addPlugInSingleRowFunction(String functionName, ...) (various footprints) Replaced by ConfigurationCompiler#addPlugInSingleRowFunction (various footprints)
addPlugInView(String namespace, String name, String viewFactoryClass) Replaced by ConfigurationCompiler#addPlugInView
addImport(String importName) (various footprints) Replaced by ConfigurationCommon#addImport (various footprints)
addAnnotationImport(String importName) (various footprints) Replaced by ConfigurationCommon#addAnnotationImport (various footprints)
isEventTypeExists(String eventTypeName) Replaced by EPEventTypeService#getEventType
addEventType(String eventTypeName, ...) (various footprints) Replaced by ConfigurationCommon#addEventType (various footprints) and create schema.
addEventTypeAvro(String eventTypeName, ConfigurationEventTypeAvro avro) Replaced by ConfigurationCommon#addEventTypeAvro (various footprints) and create avro schema.
addVariable(String variableName, ...) (various footprints) Replaced by ConfigurationCommon#addVariable (various footprints) and create variable.
addPlugInEventType(String eventTypeName, URI[] resolutionURIs, Serializable initializer) Removed without replacement.
void setPlugInEventTypeResolutionURIs(URI[] urisToResolveName) Removed without replacement.
addRevisionEventType(String revisioneventTypeName, ConfigurationRevisionEventType revisionEventTypeConfig) Removed without replacement.
addVariantStream(String variantStreamName, ConfigurationVariantStream variantStreamConfig) Replaced by ConfigurationCommon#addVariantStream (various footprints) and create variant schema.
updateMapEventType(String mapeventTypeName, Map typeMap) Removed without replacement.
boolean isVariantStreamExists Replaced by ConfigurationCommon#getVariantStreams.
setMetricsReportingInterval(String stmtGroupName, long newIntervalMSec) Method moved to EPMetricsService, obtain using EPRuntime#getMetricsRuntime.
setMetricsReportingStmtEnabled(String statementName) Method moved to EPMetricsService, obtain using EPRuntime#getMetricsRuntime.
setMetricsReportingStmtDisabled(String statementName) Method moved to EPMetricsService, obtain using EPRuntime#getMetricsRuntime.
setMetricsReportingEnabled() Method moved to EPMetricsService, obtain using EPRuntime#getMetricsRuntime.
setMetricsReportingDisabled() Method moved to EPMetricsService, obtain using EPRuntime#getMetricsRuntime.
boolean removeEventType(String name, boolean force) Removed without replacement. Undeploying a module removes the event types owned by the module.
Set getEventTypeNameUsedBy(String eventTypeName) Removed without replacement. Please let us know if you need this functionality.
Set getVariableNameUsedBy(String variableName) Removed without replacement. Please let us know if you need this functionality.
boolean removeVariable(String name, boolean force) Removed without replacement. Undeploying a module removes the variables owned by the module.
void replaceXMLEventType(String xmlEventTypeName, ConfigurationEventTypeXMLDOM config) Removed without replacement.
EventType getEventType(String eventTypeName) Replaced by EPEventTypeService#getEventType
EventType[] getEventTypes() Removed without replacement.
setPatternMaxSubexpressions(Long maxSubexpressions) Removed without replacement.
setMatchRecognizeMaxStates(Long maxStates) Removed without replacement.
updateObjectArrayEventType(String myEvent, String[] namesNew, Object[] typesNew) Removed without replacement.
getTransientConfiguration() Replaced by EPRuntime#getConfigurationTransient

EPVariableService

The methods of EPRuntime (old API) that are related to variables have been moved to this class.
Obtain from EPRuntime#getVariableService.

Esper-7 Esper-8
EPRuntime#getVariableValue(String variableName) (various footprints) Object getVariableValue(String deploymentId, String variableName) (various footprints) Method now requires the deployment-id of the variable.
EPRuntime#setVariableValue(String variableName, Object variableValue) (various footprints) setVariableValue(String deploymentId, String variableName, Object variableValue) Method now requires the deployment-id of the variable.
EPRuntime#getVariableValuesAll() Map<DeploymentIdNamePair, Object> getVariableValueAll(); Method now returns a map keyed by pair of deployment-id and variable name.

EPOnDemandPreparedQuery

This class was renamed to EPFireAndForgetPreparedQuery.

EPOnDemandPreparedQueryParameterized

This class was renamed to EPFireAndForgetPreparedQueryParameterized.

EPOnDemandQueryResult

This class was renamed to EPFireAndForgetQueryResult.

Statement Object Model API Changes

The changes in the statement object model classes between Esper-8 and Esper-7 are:

Class Changes
CreateSchemaClause The field treeObjectName wasn't used and was removed.
CreateTableColumn The fields optionalTypeIsArray and optionalTypeIsPrimitiveArray have been removed. The optionalTypeName
can now have "[]" appended for arrays and "[primitive]" for array-of-primitive or multiple "[]" for dimensions.
SchemaColumnDesc Same as above.
CreateVariableClause Same as above.
CreateWindowClause The new fields asEventTypeName for the event type name when provided. This information no longer resides in the from-clause.
2019-06-28T17:17:51+00:00Esper-8|

Esper-8 Migrating Configuration From Older Versions

Introduction

Configuration now has 3 sections:

  1. Common section: All configuration common to the compiler and the runtime
  2. Compiler section: Configuration that applies to the compiler only
  3. Runtime section: Configuration that applies to the runtime only

The compiler ignores the runtime section of the configuration, and the runtime ignores the compiler section of the configuration.

Configuration Object Class and Package Name

Esper-8 moved configuration classes to com.espertech.esper.common.client.configuration and the common, compiler and runtime packages.

Esper-8 renamed configuration classes. A table of renamed classes can be found below. Certain configuration inner classes have been moved to com.espertech.esper.common.client.util.

Migrating XML files

The new schema is esper-configuration-8-0.xsd .

NOTE: The new schema is not compatible with the version 7 schema.

The new schema moves all configuration to <common>, <compiler> and <runtime> elements.

EsperTech provides an online cloud-based application that can read an existing Esper-7 XML configuration and produce an Esper-8 XML configuration. The link is http://esper-config-upgrade7to8.appspot.com.
The class that provides the functionality is com.espertech.esper.common.client.configuration.ConfigurationSchema7To8Upgrade.

Table of Updates

The below table is structured by configuration topic. Within the topic the table describes into which section (common, compiler, runtime) the configuration moves.

In some cases, specifically for engine settings, multiple sections may apply. In this case the table provides instructions which subset of properties belongs to which section.

Category Move to Esper-7 Esper-8
Event Types common <event-type> <common><event-type></common>
ConfigurationEventTypeLegacy ConfigurationCommonEventTypeBean
ConfigurationEventTypeMap ConfigurationCommonEventTypeMap
ConfigurationEventTypeObjectArray ConfigurationCommonEventTypeObjectArray
ConfigurationEventTypeXMLDOM ConfigurationCommonEventTypeXMLDOM
ConfigurationEventTypeAvro ConfigurationCommonEventTypeAvro
Event Type Auto Name common <event-type-auto-name> <common><event-type-auto-name></common>
Imports common <auto-import> <common><auto-import></common>
Annotation Imports common <auto-import-annotations> <common><auto-import-annotations></common>
Database References common <database-reference> <common><database-reference></common>
ConfigurationDBRef ConfigurationCommonDBRef
Method Join References common <method-reference> <common><method-reference></common>
ConfigurationMethodRef ConfigurationCommonMethodRef
Variables common <variable> <common><variable></common>
ConfigurationVariable ConfigurationCommonVariable
Variant Stream common <variant-stream> <common><variant-stream></common>
ConfigurationVariantStream ConfigurationCommonVariantStream
Byte Code Generation compiler <bytecodegen> <compiler><bytecode></compiler> (Note: Element name rename. Note: Configuration items changed significantly.)
ConfigurationEngineDefaults.ByteCodeGeneration ConfigurationCompilerByteCode (Note: Configuration items changed significantly.)
Plug-In View compiler <plugin-view> <compiler><plugin-view></compiler> (NOTE: requires configuring a forge class)
ConfigurationPlugInView ConfigurationCompilerPlugInView
Plug-In Virtual Data Window compiler <plugin-virtualdw> <compiler><plugin-virtualdw></compiler> (NOTE: requires configuring a forge class)
ConfigurationPlugInVirtualDataWindow ConfigurationCompilerPlugInVirtualDataWindow
Plug-In Aggregation Function compiler <plugin-aggregation-function> <compiler><plugin-aggregation-function></compiler> (NOTE: requires configuring a forge class)
ConfigurationPlugInAggregationFunction ConfigurationCompilerPlugInAggregationFunction
Plug-In Aggregation Multi-Function compiler <plugin-aggregation-multifunction> <compiler><plugin-aggregation-multifunction></compiler> (NOTE: requires configuring a forge class)
ConfigurationPlugInAggregationMultiFunction ConfigurationCompilerPlugInAggregationMultiFunction (NOTE: requires configuring a forge class)
Plug-In Single-Row Function compiler <plugin-singlerow-function> <compiler><plugin-singlerow-function></compiler>
ConfigurationPlugInSingleRowFunction ConfigurationCompilerPlugInSingleRowFunction
Plug-In Pattern Guard compiler <plugin-pattern-guard> <compiler><plugin-pattern-guard></compiler> (NOTE: requires configuring a forge class)
ConfigurationPlugInPatternObject ConfigurationCompilerPlugInPatternObject
Plug-In Pattern Observer compiler <plugin-pattern-observer> <compiler><plugin-pattern-observer></compiler> (NOTE: requires configuring a forge class)
ConfigurationPlugInPatternObject ConfigurationCompilerPlugInPatternObject
Plug-In Loader runtime <plugin-loader> <runtime><plugin-loader></runtime>
ConfigurationPluginLoader ConfigurationRuntimePluginLoader
Engine Settings - Threading runtime <engine-settings><threading></engine-settings> <runtime><threading></runtime>
ConfigurationEngineDefaults.Threading ConfigurationRuntimeThreading
Engine Settings - Event Type Meta Information common <engine-settings><event-meta></engine-settings> <common><event-meta></common>
ConfigurationEngineDefaults.EventMeta ConfigurationCommonEventTypeMeta
Engine Settings - View Resources compiler <engine-settings><view-resources></engine-settings> <compiler><view-resources></compiler>
ConfigurationEngineDefaults.ViewResources ConfigurationCompilerViewResources
Engine Settings - Logging common, compiler and runtime <engine-settings><logging></engine-settings> <common><logging></common> (see below)
<compiler><logging></compiler> (see below)
<compiler><logging></compiler> (see below)
ConfigurationEngineDefaults.Logging ConfigurationCommonLogging, ConfigurationCompilerLogging, ConfigurationRuntimeLogging
common Query-plan and jdbc
compiler Code logging
runtime Audit pattern, execution path, timer debug
Engine Settings - Logging common and compiler and runtime <engine-settings><logging></engine-settings> <common><logging></common> (see below)
<compiler><logging></compiler> (see below)
<runtime><logging></runtime> (see below)
ConfigurationEngineDefaults.Logging ConfigurationCommonLogging, ConfigurationCompilerLogging, ConfigurationRuntimeLogging
Engine Settings - Variables runtime <engine-settings><variables></engine-settings> <runtime><variables></runtime>
ConfigurationEngineDefaults.Variables ConfigurationRuntimeVariables
Engine Settings - Patterns runtime <engine-settings><patterns></engine-settings> <runtime><patterns></runtime>
ConfigurationEngineDefaults.Patterns ConfigurationRuntimePatterns
Engine Settings - Match-Recognize runtime <engine-settings><match-recognize></engine-settings> <runtime><match-recognize></runtime>
ConfigurationEngineDefaults.MatchRecognize ConfigurationRuntimeMatchRecognize
Engine Settings - Match-Recognize runtime <engine-settings><match-recognize></engine-settings> <runtime><match-recognize></runtime>
ConfigurationEngineDefaults.MatchRecognize ConfigurationRuntimeMatchRecognize
Engine Settings - Stream Selection compiler <engine-settings><stream-selection></engine-settings> <compiler><stream-selection></compiler>
ConfigurationEngineDefaults.StreamSelection ConfigurationCompilerStreamSelection
Engine Settings - Time Source common and runtime <engine-settings><time-source></engine-settings> <common><time-source></common> for the "timeUnit" setting and <runtime><time-source></runtime> for the "timeSourceType" setting
ConfigurationEngineDefaults.TimeSource ConfigurationCommonTimeSource and ConfigurationRuntimeTimeSource
Engine Settings - Metrics Reporting runtime <engine-settings><metrics-reporting></engine-settings> <runtime><metrics-reporting></runtime>
ConfigurationMetricsReporting ConfigurationRuntimeMetricsReporting
Engine Settings - Language compiler <engine-settings><language></engine-settings> <compiler><language></compiler>
ConfigurationEngineDefaults.Language ConfigurationCompilerLanguage
Engine Settings - Expression compiler and runtime <engine-settings><expression></engine-settings> <compiler><expression></compiler> and <runtime><expression></runtime>
ConfigurationEngineDefaults.Expression ConfigurationCompilerExpression and ConfigurationRuntimeExpression
compiler For all expression settings except "selfSubselectPreeval" and "timezone"
runtime For expression settings "selfSubselectPreeval" and "timezone"
Engine Settings - Execution common, compiler and runtime <engine-settings><execution></engine-settings> <common><execution></common> and <compiler><execution></compiler> and <runtime><execution></runtime>
ConfigurationEngineDefaults.Execution ConfigurationCommonExecution and ConfigurationCompilerExecution and ConfigurationRuntimeExecution
common For "threadingProfile" setting
compiler For "filterServiceMaxFilterWidth" setting
runtime For all other settings
Engine Settings - Exception Handling runtime <engine-settings><exceptionHandling></engine-settings> <runtime><exceptionHandling></runtime>
ConfigurationEngineDefaults.ExceptionHandling ConfigurationRuntimeExceptionHandling
Engine Settings - Condition Handling runtime <engine-settings><conditionHandling></engine-settings> <runtime><conditionHandling></runtime>
ConfigurationEngineDefaults.ConditionHandling ConfigurationRuntimeConditionHandling
Engine Settings - Scripts compiler <engine-settings><scripts></engine-settings> <compiler><scripts></compiler>
ConfigurationEngineDefaults.Scripts ConfigurationCompilerScripts
Revision Event Type <revision-event-type> Not supported by Esper 8
Plug-in Event Representation <plugin-event-representation> Not supported by Esper 8
<plugin-event-type> Not supported by Esper 8
<plugin-event-type-name-resolution> Not supported by Esper 8

Removed Configuration

  • The view resources configuration removes the share-views setting and the allow-multiple-expiry-policy setting.
  • The execution configuration removes the allow-isolated-service setting.
  • The runtime threading engine-fairlock is now runtime-fairlock.
  • The runtime metrics reporting engine-interval is now runtime-interval.
  • The runtime metrics reporting jmx-engine-metrics is now jmx-runtime-metrics.
  • The HA-configuration enginelock-settings is now runtimelock-settings.
2019-06-28T17:17:58+00:00Esper-8|

Esper-8 Conceptual Differences to Older Versions

This section overviews conceptual changes and is not an all-inclusive statement of changes. It is intended to provide background information.

Removed CGLIB Dependency

As the compiler generates all the byte code to access event properties and call methods we removed the CGLIB library as a dependency entirely.

ANTLR Jar Dependency Only at Compile-Time

Only the compiler needs the ANTLR library and the runtime does not need ANTLR anymore. The only dependency of the runtime is the SLF4J library.

Public API Names

In Esper 8 the compiler and runtime and replace the service provider of Esper 7. The term "service provider" and "engine" were thus replaced by runtime. The resulting name changes in the public API are substantial. Some of the renamed classes are listed below. Please consult the API-migration doc for a table on impacted classes.

  • EPServiceProviderManager is now EPRuntimeProvider
  • EPServiceProvider is now EPRuntime
  • EPRuntime is now EPEventService
  • EPAdministrator is now EPDeploymentService

Names for Statements, Event Types, Named Windows, Tables, Variables, Contexts, Expressions, Scripts and Indexes

The compiler does not have access to deployment-time names and therefore cannot determine whether a name is already used or not.

For example, an EPL module defines a statement by name "A" using "@name('A')". The statement name may already be used by another statement in the runtime environment. In Esper-7 a statement name was unique across the runtime and Esper-7 simply generated a new statement name. Generating a new name however is not an option for variable names, context names, named window names and others.

Therefore in Esper-8 a name is unique in combination with the deployment-id. This is true for all names such as statement name, context name, variable name and others.

For example, an EPL module may define a statement by name "A". The compiler compiles the module to byte code. The runtime deploys the byte code using deployment id 'D1'. The statement is uniquely named as a combination of deployment id and statement name. The combined key is {deploymentId='D1', statementName='A'}.

This change meant that all APIs that handle names must take the deployment id as an additional parameter or must return the deployment id as part of the result. Your application must iterate and find statements using deployment ids.

EPL Module as the Source Code Unit

EPL modules consist of EPL statements. The compiler compiles EPL modules to byte code and you can deploy that byte code to the runtime. Any single EPL statement must be part of a module for compiling and deploying.

Esper-8 thus removes the single EPL statement as a unit and removes the "createEPL" methods for creating a single statement. It also removes the statement lifecycle, therefore the statement "stop", "start" and "destroy" methods are removed. They are replaced by "deploy" and "undeploy" for byte code and deployment lifecycle.

Configuration

The compiler and runtime are now completely separated. This meant that the configuration that applies to the compiler needed to be separated from the configuration that applies to the runtime. There are some common parts to configuration that can apply at compile-time and at runtime.

Keeping one configuration object that contains a common, a compiler and a runtime configuration is easiest to use. It however means that existing configuration must all migrate to one of the 3 sections.

In effect this means the configuration XML now has a <common>, <compiler> and <runtime>. In turn the configuration class offers Configuration#getCommon, Configuration#getCompiler and Configuration#getRuntime.

Bean Event Types

One of the issues that users of Esper-7 had trouble with was the fact that Esper-7 identified Bean-style event types by class disallowing use of the same class to represent multiple event types without subclassing. Esper-8 identifies a Bean-style event type by name that consistent with all other event types.

In Esper-7 the from-clause could specify a full-qualified or otherwise resolvable class name and Esper-7 would dynamically allocate a bean event type for the same fully-qualified class name. With the compiler architecture this behavior would cause implicit type references.

In Esper-8 all event types are either preconfigured or allocated using create schema or insert into.

Duplicate Listener Interfaces

In Esper-7 there were two types of listeners. Esper-8 simplifies the listener interface into a single UpdateListener interface.

Subscribers

As the compiler produces byte code for delivering results to subscribers, that byte code is unnecessary for applications that don't use subscribers. In Esper-8 there is a new setting to control whether the compile produces byte code for subscribers.

Substitution Parameters

In many cases the compiler must know the type of the substitution parameter to ensure type-safety. Therefore Esper-8 supports a type name for substitution parameters, using "?:name:type". The compiler must assume Object-type in case the EPL does not provide a type.

2019-06-28T17:18:05+00:00Esper-8|

Esper-8 Compiler and Runtime

Beginning with version 8 Esper has a compiler and runtime architecture. With version 8 Esper is a language, a language compiler and a runtime environment.

The Esper language is the Event Processing Language (EPL). It is a declarative, data-oriented language for dealing with high frequency time-based event data. EPL is compliant to the SQL-92 standard and extended for analyzing series of events and in respect to time.

The Esper compiler compiles EPL source code into Java Virtual Machine (JVM) bytecode so that the resulting executable code runs on a JVM within the Esper runtime environment.

The Esper runtime runs on top of a JVM. You can run byte code produced by the Esper compiler using the Esper runtime.

The Esper architecture is similar to that of other programming languages that are compiled to JVM bytecode, such as Scala, Clojure and Kotlin for example. Esper EPL however is not an imperative (procedural) programming language.

Runtime - Better performance

The Esper-8 compiler produces byte code that has better performance executing queries in the runtime. The compiler produces byte code for select-clauses, result-set-building, all expressions and event properties and much more. This removes virtual calls as interface calls are replaced by just byte code. The Esper compiler also removes certain down casting and branching that would otherwise need to be done.

Since the Esper-8 compiler produces byte code this gives the JVM a chance to use JIT (just-in-time) to produce native machine code, remove null checks, inline methods, predict branches etc..

Runtime - Uses less heap memory

For aggregations the Esper-8 compiler produces a custom aggregation row class that has fields which represent the aggregation state. Therefore each aggregation row does not have additional objects to represent things like averages or sums and instead things like average and sum in Esper-8 are simply a bunch of fields on the same object. Since aggregations are often used with group-by and since the runtime may be tracking a lot of rows, it is nice that the number of objects per row is always one for Esper-8. For Esper-7 the number of objects per row would be one object per row and one object for each value in the row.

When the Esper-8 compiler produces byte code it discards any intermediary representation of the EPL. The compiler discards all things like the abstract syntax tree (AST) that resulted from parsing EPL. It discards all the expression trees which represent the different expressions. It discards any statement specification objects and the query plan. All this intermediary information now results in byte code.

The JVM loads the byte code that the EPL compiler produced into a separate "classes" space and does not use heap. In Esper-8 there is only a small amount of EPL metadata that uses heap. JVM byte code is compact and space-efficient.

Runtime - Removes runtime library dependencies

The Esper-8 runtime only needs the SLF4J logging framework and has no other library dependencies. Keeping the runtime small, clean and embeddable is the advantage.

Runtime - Recovery performance

The Esper-8 compiler produces byte code that can be saved to a jar file. When recovering a system the byte code is already available and ready for loading into a runtime. This cuts recovery time dramatically because it eliminates the compiler steps of parsing, walking, validating and query planning. On recovery the Esper-8 runtime can simply load existing classes and initialize. This works well together with EsperHA which also loads only metadata at recovery time and since EsperHA loads state lazily when needed after a recovery.

Compiler performance

The Esper-8 compiler is a stateless service that can compile in parallel and with multiple threads. The Esper-7 architecture did not allow parallel operations in respect to compiling. The Esper-8 compiler can compile any number of EPL modules in parallel (as long as they are not interdependent).

Separation of concerns

The Esper-8 compiler can compile EPL in a process or system that is separate from the runtime thus eliminating the possibility of impacting a running system.
Before Esper-8 there was no way to fully validate EPL without deploying. With Esper-8 the validation/compilation and deployment are well separated.

Artifact management

The Esper-8 compiler produces byte code and jar files. This enables managing and deploying jar files using build tools and repositories.

Tools - Improved use with JVM profiler tools

As JVM profiler tools can instrument byte code the profiler tool reporting is more relevant.

Multi-tenancy related functionality

The compiler architecture provides a clean strategy for name management and managing dependencies between EPL modules as compiling and deploying are steps that can be separated in time and on different systems. The Esper-8 compiler and runtime allow modules to have their own namespace thus preventing name conflicts. With Esper-8 there is now explicit management of inter-module dependencies on EPL-objects such as event types, named window and others.

2019-06-28T17:18:12+00:00Esper-8|
Go to Top