Exemple #1
0
        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 SetUpdateListeners(
            EPStatementListenerSet listenerSet,
            bool isRecovery)
        {
            // indicate that listeners were updated for potential persistence of listener set, once the statement context is known
            if (_epStatement != null) {
                if (!isRecovery) {
                    var stmtCtx = _epStatement.StatementContext;
                    _epServicesContext.EpServicesHA.ListenerRecoveryService.Put(
                        stmtCtx.StatementId, 
                        stmtCtx.StatementName, 
                        listenerSet.Listeners);
                }
            }

            StatementListenerSet = listenerSet;

            IsMakeNatural = StatementListenerSet.Subscriber != null;
            IsMakeSynthetic = StatementListenerSet.Listeners.Length != 0 
                              || _statementInformationals.IsAlwaysSynthesizeOutputEvents;

            if (StatementListenerSet.Subscriber == null) {
                _statementResultNaturalStrategy = null;
                IsMakeNatural = false;
                return;
            }

            try {
                _statementResultNaturalStrategy = ResultDeliveryStrategyFactory.Create(
                    _epStatement,
                    StatementListenerSet.Subscriber, 
                    StatementListenerSet.SubscriberMethodName,
                    _selectClauseTypes, 
                    _selectClauseColumnNames, 
                    _runtime.URI, 
                    _runtime.ServicesContext.ImportServiceRuntime);
                IsMakeNatural = true;
            }
            catch (ResultDeliveryStrategyInvalidException ex) {
                throw new EPSubscriberException(ex.Message, ex);
            }
        }