public void SetUpdateListeners(EPStatementListenerSet updateListeners, bool isRecovery) { // indicate that listeners were updated for potential persistence of listener set, once the statement context is known if (_epStatement != null) { _statementLifecycleSvc.UpdatedListeners(_epStatement, updateListeners, isRecovery); } _statementListenerSet = updateListeners; _isMakeNatural = _statementListenerSet.Subscriber != null; _isMakeSynthetic = _statementListenerSet.HasEventConsumers || _isPattern || _isInsertInto || _isDistinct | _isForClause; if (_statementListenerSet.Subscriber == null) { _statementResultNaturalStrategy = null; _isMakeNatural = false; return; } _statementResultNaturalStrategy = ResultDeliveryStrategyFactory.Create( _statementName, _statementListenerSet.Subscriber, _selectClauseTypes, _selectClauseColumnNames); _isMakeNatural = true; }
public void SetUp() { _container = SupportContainer.Reset(); MetricReportingPath.IsMetricsEnabled = false; _listenerOne = new SupportUpdateListener(); _listenerTwo = new SupportUpdateListener(); EPStatementListenerSet listenerSet = new EPStatementListenerSet(); listenerSet.Events.Add(_listenerOne.Update); listenerSet.Events.Add(_listenerTwo.Update); _dispatchService = new DispatchServiceImpl(_container.Resolve <IThreadLocalManager>()); _statementResultService = new StatementResultServiceImpl( "name", null, null, new ThreadingServiceImpl(new ConfigurationEngineDefaults.ThreadingConfig()), _container.Resolve <IThreadLocalManager>()); _statementResultService.SetUpdateListeners(listenerSet, false); _statementResultService.SetSelectClause( new Type[1], new string[1], false, new ExprEvaluator[1], new SupportExprEvaluatorContext(_container, null)); _statementResultService.SetContext(new SupportEPStatementSPI(), null, false, false, false, false, null); _updateDispatchView = new UpdateDispatchViewBlockingWait( _statementResultService, _dispatchService, 1000, _container.Resolve <IThreadLocalManager>()); }
/// <summary> /// Ctor. /// </summary> /// <param name="expressionNoAnnotations">expression text witout annotations</param> /// <param name="isPattern">is true to indicate this is a pure pattern expression</param> /// <param name="dispatchService">for dispatching events to listeners to the statement</param> /// <param name="statementLifecycleSvc">handles lifecycle transitions for the statement</param> /// <param name="timeLastStateChange">the timestamp the statement was created and started</param> /// <param name="isBlockingDispatch">is true if the dispatch to listeners should block to preserve event generation order</param> /// <param name="isSpinBlockingDispatch">true to use spin locks blocking to deliver results, as locks are usually uncontended</param> /// <param name="msecBlockingTimeout">is the max number of milliseconds of block time</param> /// <param name="timeSourceService">time source provider</param> /// <param name="statementMetadata">statement metadata</param> /// <param name="userObject">the application define user object associated to each statement, if supplied</param> /// <param name="statementContext">the statement service context</param> /// <param name="isFailed">indicator to start in failed state</param> /// <param name="nameProvided">true to indicate a statement name has been provided and is not a system-generated name</param> public EPStatementImpl( String expressionNoAnnotations, bool isPattern, DispatchService dispatchService, StatementLifecycleSvc statementLifecycleSvc, long timeLastStateChange, bool isBlockingDispatch, bool isSpinBlockingDispatch, long msecBlockingTimeout, TimeSourceService timeSourceService, StatementMetadata statementMetadata, Object userObject, StatementContext statementContext, bool isFailed, bool nameProvided) { _statementLifecycleSvc = statementLifecycleSvc; _statementListenerSet = new EPStatementListenerSet(); IsPattern = isPattern; ExpressionNoAnnotations = expressionNoAnnotations; StatementContext = statementContext; IsNameProvided = nameProvided; if (isBlockingDispatch) { if (isSpinBlockingDispatch) { _dispatchChildView = new UpdateDispatchViewBlockingSpin( statementContext.StatementResultService, dispatchService, msecBlockingTimeout, timeSourceService, statementContext.ThreadLocalManager); } else { _dispatchChildView = new UpdateDispatchViewBlockingWait( statementContext.StatementResultService, dispatchService, msecBlockingTimeout, statementContext.ThreadLocalManager); } } else { _dispatchChildView = new UpdateDispatchViewNonBlocking( statementContext.StatementResultService, dispatchService, statementContext.ThreadLocalManager); } State = !isFailed ? EPStatementState.STOPPED : EPStatementState.FAILED; TimeLastStateChange = timeLastStateChange; StatementMetadata = statementMetadata; UserObject = userObject; statementContext.StatementResultService.SetUpdateListeners(_statementListenerSet, false); }
/// <summary>Returns the set of listeners to the statement. </summary> /// <listenerSet>statement listeners</listenerSet> public void SetListenerSet(EPStatementListenerSet value, bool isRecovery) { _statementListenerSet.Copy(value); StatementContext.StatementResultService.SetUpdateListeners(value, isRecovery); }
public void SetListeners(EPStatementListenerSet listenerSet, bool isRecovery) { _statementListenerSet.Copy(listenerSet); StatementContext.StatementResultService.SetUpdateListeners(listenerSet, isRecovery); }
/// <summary>Copy the update listener set to from another.</summary> /// <param name="listenerSet">a collection of Update listeners</param> public void Copy(EPStatementListenerSet listenerSet) { Events = listenerSet.Events; }