Exemplo n.º 1
0
        private void StartContextCallback(long timeOffset)
        {
            var scheduleCallback = new ProxyScheduleHandleCallback()
            {
                ProcScheduledTrigger = extensionServicesContext =>
                {
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().QContextScheduledEval(_agentInstanceContext.StatementContext.ContextDescriptor);
                    }
                    _scheduleHandle = null; // terminates automatically unless scheduled again
                    _callback.RangeNotification(Collections.GetEmptyMap <String, Object>(), this, null, null, _filterAddendum);
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().AContextScheduledEval();
                    }
                }
            };
            var agentHandle =
                new EPStatementAgentInstanceHandle(
                    _agentInstanceContext.StatementContext.EpStatementHandle,
                    _agentInstanceContext.StatementContext.DefaultAgentInstanceLock, -1,
                    new StatementAgentInstanceFilterVersion(),
                    _agentInstanceContext.StatementContext.FilterFaultHandlerFactory);

            _scheduleHandle = new EPStatementHandleCallback(agentHandle, scheduleCallback);


            long timeDelta = _spec.TimePeriod.NonconstEvaluator().DeltaUseEngineTime(null, _agentInstanceContext) - timeOffset;

            _agentInstanceContext.StatementContext.SchedulingService.Add(timeDelta, _scheduleHandle, _scheduleSlot);
        }
        private void StartContextCallback()
        {
            var scheduleCallback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = (extensionServicesContext) =>
                {
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().QContextScheduledEval(_statementContext.ContextDescriptor);
                    }
                    _scheduleHandle = null;  // terminates automatically unless scheduled again
                    _callback.RangeNotification(Collections.EmptyDataMap, this, null, null, _filterAddendum);
                    if (InstrumentationHelper.ENABLED)
                    {
                        InstrumentationHelper.Get().AContextScheduledEval();
                    }
                }
            };
            var agentHandle = new EPStatementAgentInstanceHandle(_statementContext.EpStatementHandle, _statementContext.DefaultAgentInstanceLock, -1, new StatementAgentInstanceFilterVersion(), _statementContext.FilterFaultHandlerFactory);

            _scheduleHandle = new EPStatementHandleCallback(agentHandle, scheduleCallback);
            var schedulingService   = _statementContext.SchedulingService;
            var engineImportService = _statementContext.EngineImportService;
            var nextScheduledTime   = ScheduleComputeHelper.ComputeDeltaNextOccurance(_spec.Schedule, schedulingService.Time, engineImportService.TimeZone, engineImportService.TimeAbacus);

            _statementContext.SchedulingService.Add(nextScheduledTime, _scheduleHandle, _scheduleSlot);
        }
Exemplo n.º 3
0
        private void FilterMatchFound(EventBean theEvent)
        {
            IDictionary <String, Object> props = Collections.GetEmptyMap <string, object>();

            if (_endpointFilterSpec.OptionalFilterAsName != null)
            {
                props = Collections.SingletonDataMap(_endpointFilterSpec.OptionalFilterAsName, theEvent);
            }
            _callback.RangeNotification(props, this, theEvent, null, _filterAddendum);
        }
 private void FilterMatchFound(EventBean theEvent)
 {
     // For OR-type filters we de-duplicate here by keeping the last event instance
     if (_endpointFilterSpec.FilterSpecCompiled.Parameters.Length > 1)
     {
         if (theEvent == _lastEvent)
         {
             return;
         }
         _lastEvent = theEvent;
     }
     IDictionary<string, Object> props = Collections.EmptyDataMap;
     if (_endpointFilterSpec.OptionalFilterAsName != null)
     {
         props = Collections.SingletonDataMap(_endpointFilterSpec.OptionalFilterAsName, theEvent);
     }
     _callback.RangeNotification(props, this, theEvent, null, _filterAddendum);
 }
Exemplo n.º 5
0
        public bool Activate(
            EventBean optionalTriggeringEvent,
            ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider)
        {
            ScheduleHandleCallback scheduleCallback = new ProxyScheduleHandleCallback {
                ProcScheduledTrigger = () => {
                    var inProcAgentInstanceContext = controller.Realization.AgentInstanceContextCreate;
                    inProcAgentInstanceContext.InstrumentationProvider.QContextScheduledEval(
                        inProcAgentInstanceContext.StatementContext.ContextRuntimeDescriptor);

                    scheduleHandle = null; // terminates automatically unless scheduled again
                    inProcAgentInstanceContext.AuditProvider.ScheduleFire(
                        inProcAgentInstanceContext,
                        ScheduleObjectType.context,
                        NAME_AUDITPROVIDER_SCHEDULE);
                    callback.RangeNotification(conditionPath, this, null, null, null, null);

                    inProcAgentInstanceContext.InstrumentationProvider.AContextScheduledEval();
                }
            };
            var agentInstanceContext = controller.Realization.AgentInstanceContextCreate;
            scheduleHandle = new EPStatementHandleCallbackSchedule(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                scheduleCallback);
            long nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance(
                Schedule,
                agentInstanceContext.TimeProvider.Time,
                agentInstanceContext.ImportServiceRuntime.TimeZone,
                agentInstanceContext.ImportServiceRuntime.TimeAbacus);
            agentInstanceContext.AuditProvider.ScheduleAdd(
                nextScheduledTime,
                agentInstanceContext,
                scheduleHandle,
                ScheduleObjectType.context,
                NAME_AUDITPROVIDER_SCHEDULE);
            agentInstanceContext.SchedulingService.Add(nextScheduledTime, scheduleHandle, scheduleSlot);
            return false;
        }
        public bool Activate(
            EventBean optionalTriggeringEvent,
            ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider,
            IDictionary<string, object> optionalTriggeringPattern)
        {
            ScheduleHandleCallback scheduleCallback = new ProxyScheduleHandleCallback() {
                ProcScheduledTrigger = () => {
                    AgentInstanceContext agentInstanceContextX = controller.Realization.AgentInstanceContextCreate;
                    agentInstanceContextX.InstrumentationProvider.QContextScheduledEval(
                        agentInstanceContextX.StatementContext.ContextRuntimeDescriptor);

                    scheduleHandle = null; // terminates automatically unless scheduled again
                    agentInstanceContextX.AuditProvider.ScheduleFire(
                        agentInstanceContextX,
                        ScheduleObjectType.context,
                        NAME_AUDITPROVIDER_SCHEDULE);
                    callback.RangeNotification(conditionPath, this, null, null, null, null);

                    agentInstanceContextX.InstrumentationProvider.AContextScheduledEval();
                },
            };
            AgentInstanceContext agentInstanceContext = controller.Realization.AgentInstanceContextCreate;
            scheduleHandle = new EPStatementHandleCallbackSchedule(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                scheduleCallback);
            long timeDelta = timePeriod.TimePeriodCompute.DeltaUseRuntimeTime(
                null,
                agentInstanceContext,
                agentInstanceContext.TimeProvider);
            agentInstanceContext.AuditProvider.ScheduleAdd(
                timeDelta,
                agentInstanceContext,
                scheduleHandle,
                ScheduleObjectType.context,
                NAME_AUDITPROVIDER_SCHEDULE);
            agentInstanceContext.SchedulingService.Add(timeDelta, scheduleHandle, scheduleSlot);
            return false;
        }
        private void StartContextCallback()
        {
            ScheduleHandleCallback scheduleCallback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext => Instrument.With(
                    i => i.QContextScheduledEval(_statementContext.ContextDescriptor),
                    i => i.AContextScheduledEval(),
                    () =>
                {
                    _scheduleHandle = null;     // terminates automatically unless scheduled again
                    _callback.RangeNotification(
                        Collections.GetEmptyMap <String, Object>(), this, null, null, _filterAddendum);
                })
            };

            var agentHandle = new EPStatementAgentInstanceHandle(_statementContext.EpStatementHandle, _statementContext.DefaultAgentInstanceLock, -1, new StatementAgentInstanceFilterVersion());

            _scheduleHandle = new EPStatementHandleCallback(agentHandle, scheduleCallback);
            var schedulingService = _statementContext.SchedulingService;
            var nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance(_spec.Schedule, schedulingService.Time, _statementContext.MethodResolutionService.EngineImportService.TimeZone);

            _statementContext.SchedulingService.Add(nextScheduledTime, _scheduleHandle, _scheduleSlot);
        }