Exemplo n.º 1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="epService">the EPServiceProvider for the engine runtime and services</param>
        /// <param name="usingEngineThread">true if the Adapter should set time by the scheduling service in the engine,false if it should set time externally through the calling thread</param>
        /// <param name="usingExternalTimer">true to use esper's external timer mechanism instead of internal timing</param>
        /// <param name="usingTimeSpanEvents"></param>
        protected AbstractCoordinatedAdapter(EPServiceProvider epService, bool usingEngineThread, bool usingExternalTimer, bool usingTimeSpanEvents)
        {
            UsingEngineThread   = usingEngineThread;
            UsingExternalTimer  = usingExternalTimer;
            UsingTimeSpanEvents = usingTimeSpanEvents;
            Sender = new DirectSender();

            if (epService == null)
            {
                return;
            }
            if (!(epService is EPServiceProviderSPI))
            {
                throw new ArgumentException("Invalid epService provided");
            }

            _epService         = epService;
            Runtime            = epService.EPRuntime;
            _schedulingService = ((EPServiceProviderSPI)epService).SchedulingService;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="runtime">the runtime for the engine runtime</param>
        /// <param name="usingEngineThread">true if the Adapter should set time by the scheduling service in the runtime, false if it should set time externally through the calling thread</param>
        /// <param name="usingExternalTimer">true to use esper's external timer mechanism instead of internal timing</param>
        /// <param name="usingTimeSpanEvents"></param>
        protected AbstractCoordinatedAdapter(EPRuntime runtime, bool usingEngineThread, bool usingExternalTimer, bool usingTimeSpanEvents)
        {
            UsingEngineThread   = usingEngineThread;
            UsingExternalTimer  = usingExternalTimer;
            UsingTimeSpanEvents = usingTimeSpanEvents;
            Sender = new DirectSender();

            if (runtime == null)
            {
                return;
            }
            if (!(runtime is EPRuntimeSPI runtimeSpi))
            {
                throw new ArgumentException("Invalid epService provided");
            }

            _runtime           = runtimeSpi;
            _container         = runtimeSpi.Container;
            _processEvent      = runtime.EventService;
            _schedulingService = runtimeSpi.ServicesContext.SchedulingService;
        }