public SenderRunnable(
     EPEventService runtime,
     int[] values)
 {
     this.runtime = runtime;
     this.values = values;
 }
        public void Run(Configuration configuration)
        {
            idCounter = new AtomicLong(0);
            executorService = Executors.NewCachedThreadPool();
            noActionUpdateListener = new NoActionUpdateListener();

            configuration.Runtime.Threading.IsInternalTimerEnabled = true;
            configuration.Common.AddEventType(typeof(SupportBean));
            configuration.Runtime.Threading.InsertIntoDispatchLocking = Locking.SUSPEND;

            var runtime = EPRuntimeProvider.GetRuntime(GetType().Name, configuration);
            runtime.Initialize();
            epRuntime = runtime.EventService;

            var path = new RegressionPath();
            var epl = "insert into Stream1 select count(*) as cnt from SupportBean#time(7 sec)";
            var compiled = SupportCompileDeployUtil.Compile(epl, configuration, path);
            path.Add(compiled);
            SupportCompileDeployUtil.Deploy(compiled, runtime);

            epl = epl + " output every 10 seconds";
            compiled = SupportCompileDeployUtil.Compile(epl, configuration, path);
            SupportCompileDeployUtil.DeployAddListener(compiled, "insert", noActionUpdateListener, runtime);

            var sendTickEventRunnable = new SendEventRunnable(this, 10000);
            Start(sendTickEventRunnable, 4);

            // Adjust here for long-running test
            SupportCompileDeployUtil.ThreadSleep(3000);
            sendTickEventRunnable.Shutdown = true;

            executorService.Shutdown();
            SupportCompileDeployUtil.ExecutorAwait(executorService, 1, TimeUnit.SECONDS);
            runtime.Destroy();
        }
Beispiel #3
0
 private static SupportCallEvent SendEvent(
     EPEventService runtime,
     long callId,
     string source,
     string destination,
     long startTime,
     long endTime)
 {
     var theEvent = new SupportCallEvent(callId, source, destination, startTime, endTime);
     runtime.SendEventBean(theEvent, typeof(SupportCallEvent).Name);
     return theEvent;
 }
Beispiel #4
0
        public static XmlDocument SendDefaultEvent(
            EPEventService runtime,
            string value,
            string eventTypeName)
        {
            var xml = XML.Replace("VAL1", value);

            var simpleDoc = new XmlDocument();
            simpleDoc.LoadXml(xml);

            runtime.SendEventXMLDOM(simpleDoc, eventTypeName);

            return simpleDoc;
        }
Beispiel #5
0
        private void StartEngineMetrics(
            EPServicesContext services,
            EPEventService runtime)
        {
#if FALSE
            lock (this) {
                var filterName = MetricNameFactory.Name(services.RuntimeURI, "filter");
                CommonJMXUtil.RegisterMbean(services.FilterService, filterName);
                var scheduleName = MetricNameFactory.Name(services.RuntimeURI, "schedule");
                CommonJMXUtil.RegisterMbean(services.SchedulingService, scheduleName);
                var runtimeName = MetricNameFactory.Name(services.RuntimeURI, "runtime");
                CommonJMXUtil.RegisterMbean(runtime, runtimeName);
            }
#endif
        }
Beispiel #6
0
        public virtual void SetUp()
        {
            var container = ContainerExtensions.CreateDefaultContainer();

            var configuration = new Configuration(container);

            configuration.Common.EventMeta.ClassPropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE;
            configuration.Common.AddEventType("TxnEventA", typeof(TxnEventA));
            configuration.Common.AddEventType("TxnEventB", typeof(TxnEventB));
            configuration.Common.AddEventType("TxnEventC", typeof(TxnEventC));

            _runtime = EPRuntimeProvider.GetRuntime("TestStmtBase", configuration);
            _runtime.Initialize();

            _eventService = _runtime.EventService;
        }
Beispiel #7
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;
        }
 public MyRunnable(EPEventService runtime)
 {
     this.runtime = runtime;
 }