public void destroy() { esperService.destroy(); }
private Configuration createConfig(EsperDeclaredEvents declaredEvents) { Configuration config = new Configuration(); config.setMetricsReportingDisabled(); config.getEngineDefaults().getThreading().setThreadPoolInbound(false); config.getEngineDefaults().getThreading().setThreadPoolOutbound(false); config.getEngineDefaults().getThreading().setThreadPoolRouteExec(false); config.getEngineDefaults().getThreading().setThreadPoolTimerExec(false); config.getEngineDefaults().getThreading().setInternalTimerEnabled(false); if (declaredEvents != null) { for (AbstractEventType type : declaredEvents.getEventTypes()) { String strAlias = type.getEventAlias(); if (type instanceof MapEventType) { config.addEventType(strAlias, ((MapEventType) type).getEventFields()); this.eventTypes.add(strAlias); } } } return config; }
config.getEngineDefaults().getExceptionHandling().addClass(SessionizerEsperExceptionHandlerFactory.class); String name = EsperSessionizer.class.getName() + "-" + baseName + "-" + id; esperService = EPServiceProviderManager.getProvider(name, config); if (imports != null) { for (String importName : imports) { esperService.getEPAdministrator().getConfiguration().addImport(importName); esperService.getEPAdministrator().getConfiguration().addImport(DecorateEvent.class); esperService.getEPAdministrator().getConfiguration().addImport(UpdateState.class); esperService.getEPAdministrator().getConfiguration().addImport(UpdateMetadata.class); esperService.getEPAdministrator().getConfiguration().addImport(UpdateCounter.class); esperService.getEPAdministrator().getConfiguration().addImport(UpdateDuration.class); esperService.getEPAdministrator().getConfiguration().addImport(AppendState.class); esperService.getEPAdministrator().getConfiguration().addImport(DebugSession.class); esperService.getEPAdministrator().getConfiguration().addImport(com.ebay.pulsar.sessionizer.esper.annotation.SubSession.class); esperService.getEPAdministrator().getConfiguration().addImport(ext.getAnnotation()); esperService.getEPAdministrator().getConfiguration().addImport(com.ebay.jetstream.epl.EPLUtilities.class); esperService.getEPAdministrator().getConfiguration().addImport(com.ebay.jetstream.epl.EPLUtils.class); esperService.getEPAdministrator().getConfiguration(). addPlugInSingleRowFunction("toJson", "com.ebay.jetstream.epl.EPLUtils", "toJsonString"); esperService.getEPAdministrator().getConfiguration(). addPlugInSingleRowFunction("fromJson", "com.ebay.jetstream.epl.EPLUtils", "fromJsonString"); esperService.getEPAdministrator().getConfiguration(). addVariable(VAR_SESSION_NAME, SessionVariable.class.getName(), sessionVariable, false); esperService.getEPAdministrator().getConfiguration().
config.getEngineDefaults().getExceptionHandling().addClass(SessionizerEsperExceptionHandlerFactory.class); String name = EsperController.class.getName() + "-" + baseName + "-" + Thread.currentThread().getId(); esperService = EPServiceProviderManager.getProvider(name, config); if (imports != null) { for (String importName : imports) { esperService.getEPAdministrator().getConfiguration().addImport(importName); esperService.getEPAdministrator().getConfiguration().addImport(DebugSession.class); esperService.getEPAdministrator().getConfiguration().addImport(DecorateEvent.class); esperService.getEPAdministrator().getConfiguration() .addImport(com.ebay.pulsar.sessionizer.esper.annotation.Session.class); esperService.getEPAdministrator().getConfiguration().addImport(com.ebay.jetstream.epl.EPLUtilities.class); esperService.getEPAdministrator().getConfiguration().addImport(com.ebay.jetstream.epl.EPLUtils.class); esperService.getEPAdministrator().getConfiguration() .addPlugInSingleRowFunction("toJson", "com.ebay.jetstream.epl.EPLUtils", "toJsonString"); esperService.getEPAdministrator().getConfiguration() .addPlugInSingleRowFunction("fromJson", "com.ebay.jetstream.epl.EPLUtils", "fromJsonString"); EPStatement statement = esperService.getEPAdministrator().createEPL(s); EPStatementObjectModel model = esperService.getEPAdministrator().compileEPL(s); List<AnnotationPart> annots = model.getAnnotations(); for (AnnotationPart part : annots) { if (DebugSession.class.getSimpleName().equals(part.getName())) { String prefix = (String) getAnnotationValue(part, "counter"); String field = (String) getAnnotationValue(part, "colname"); statement.addListener(new SessionizerCounterListener(prefix, field, auditValue, esperCounter));
private void processAnnotations(EsperSessionizerCounter esperCounter, boolean isMainSessionizer, Set<String> subSessionNames, List<SessionizerExtension> extensions, EPL epl) { for (String s : epl.getStatements()) { EPStatement statement = esperService.getEPAdministrator().createEPL(s); EPStatementObjectModel model = esperService.getEPAdministrator().compileEPL(s); List<AnnotationPart> annots = model.getAnnotations(); for (AnnotationPart part : annots) { if (isMainSessionizer && com.ebay.pulsar.sessionizer.esper.annotation.SubSession.class.getSimpleName().equals(part.getName())) { String sessionizerName = (String) part.getAttributes().get(0).getValue(); if (!subSessionNames.contains(sessionizerName)) { throw new IllegalArgumentException("The sub sessionizer referenced by EPL " + sessionizerName + " not configured."); statement.addListener(new SubSessionizerListener(sessionizerName, context)); if (isMainSessionizer && UpdateDuration.class.getSimpleName().equals(part.getName())) { statement.addListener(new UpdateTTLListener(context, maxTTL)); if (DecorateEvent.class.getSimpleName().equals(part.getName())) { statement.addListener(new DecorateEventListener(context)); if (AppendState.class.getSimpleName().equals(part.getName())) { statement.addListener(new AppendStateListener(context, (String) getAnnotationValue(part, "name", null), (String) getAnnotationValue(part, "colname", null), (Boolean) getAnnotationValue(part, "unique", true), (Integer) getAnnotationValue(part, "maxlength", 0))); if (UpdateState.class.getSimpleName().equals(part.getName())) { statement.addListener(new SessionStateListener(context)); if (UpdateMetadata.class.getSimpleName().equals(part.getName())) {
public Map<String, SessionizationInfo> process(JetstreamEvent event) { sessionizationMap.clear(); eventListener.reset(event); esperService.getEPRuntime().sendEvent(event, event.getEventType()); return sessionizationMap; }
@Override public void onDelete(Trigger object) { log.debug("Destroying EPSstatement:{}",epStatement.getName()); epService.getEPAdministrator().getStatement(epStatement.getName()).destroy(); } }
/** * Returns an EPServiceProvider for a given provider URI. * @param providerURI - the provider URI * @return EPServiceProvider for the given provider URI. */ public static EPServiceProvider getProvider(String providerURI) { return getProvider(providerURI, new Configuration()); }
/** * Ctor. */ protected ConfigurationEngineDefaults() { threading = new Threading(); viewResources = new ViewResources(); eventMeta = new EventMeta(); logging = new Logging(); variables = new Variables(); streamSelection = new StreamSelection(); timeSource = new TimeSource(); metricsReporting = new ConfigurationMetricsReporting(); }
public void setMetricsReportingDisabled() { this.getEngineDefaults().getMetricsReporting().setEnableMetricsReporting(false); }
public void setMetricsReportingInterval(String stmtGroupName, long newInterval) { this.getEngineDefaults().getMetricsReporting().setStatementGroupInterval(stmtGroupName, newInterval); }
/** * Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds. * <p> * Specifies the cache reference type to be weak references. Weak reference cache entries become * eligible for garbage collection and are removed from cache when the garbage collection requires so. * @param maxAgeSeconds is the maximum number of seconds before a query result is considered stale (also known as time-to-live) * @param purgeIntervalSeconds is the interval at which the engine purges stale data from the cache */ public void setExpiryTimeCache(double maxAgeSeconds, double purgeIntervalSeconds) { dataCacheDesc = new ConfigurationExpiryTimeCache(maxAgeSeconds, purgeIntervalSeconds, ConfigurationCacheReferenceType.getDefault()); }
public void addEventTypeAliasNestable(String eventTypeAlias, Map<String, Object> typeMap, String[] superTypes) { addNestableEventTypeAlias(eventTypeAlias, typeMap); if (superTypes != null) { for (int i = 0; i < superTypes.length; i++) { this.addMapSuperType(eventTypeAlias, superTypes[i]); } } }
/** * Sets the connection factory to use {@link java.sql.DriverManager} to obtain a * connection. * @param className is the driver class name to lookup up via Class.forName * @param url is the URL * @param username is the username to obtain a connection * @param password is the password to obtain a connection */ public void setDriverManagerConnection(String className, String url, String username, String password) { connectionFactoryDesc = new DriverManagerConnection(className, url, username, password); }
private Configuration createConfig(EsperDeclaredEvents declaredEvents) { Configuration config = new Configuration(); config.setMetricsReportingDisabled(); config.getEngineDefaults().getThreading().setThreadPoolInbound(false); config.getEngineDefaults().getThreading().setThreadPoolOutbound(false); config.getEngineDefaults().getThreading().setThreadPoolRouteExec(false); config.getEngineDefaults().getThreading().setThreadPoolTimerExec(false); config.getEngineDefaults().getThreading().setInternalTimerEnabled(false); if (declaredEvents != null) { for (AbstractEventType type : declaredEvents.getEventTypes()) { String strAlias = type.getEventAlias(); if (type instanceof MapEventType) { config.addEventType(strAlias, ((MapEventType) type).getEventFields()); } if (type instanceof StringEventType) { config.addEventType(strAlias, ((StringEventType) type).getEventClassName()); } } } return config; }
private void processEPL(JetstreamEvent event) { Object sesionizerList = event.remove(SessionizerProcessor.SESSIONIZER_LIST); try { esperService.getEPRuntime().sendEvent(event, event.getEventType()); } finally { if (sesionizerList != null) { event.put(SessionizerProcessor.SESSIONIZER_LIST, sesionizerList); } } }
/** * Returns the default EPServiceProvider. * @return default instance of the service. */ public static EPServiceProvider getDefaultProvider() { return getProvider(null, new Configuration()); }
public void destroy() { esperService.destroy(); }
public void setMetricsReportingEnabled() { this.getEngineDefaults().getMetricsReporting().setEnableMetricsReporting(true); }
/** * Configures an expiry-time cache of the given maximum age in seconds and purge interval in seconds. * <p> * Specifies the cache reference type to be weak references. Weak reference cache entries become * eligible for garbage collection and are removed from cache when the garbage collection requires so. * @param maxAgeSeconds is the maximum number of seconds before a method invocation result is considered stale (also known as time-to-live) * @param purgeIntervalSeconds is the interval at which the engine purges stale data from the cache */ public void setExpiryTimeCache(double maxAgeSeconds, double purgeIntervalSeconds) { dataCacheDesc = new ConfigurationExpiryTimeCache(maxAgeSeconds, purgeIntervalSeconds, ConfigurationCacheReferenceType.getDefault()); }