Example #1
0
        private void RunSubquerySample(EPServiceProvider epService)
        {
            String               epl            = "select (select key2 from MySampleWindow where key1 = ste.triggerKey) as key2 from SampleTriggerEvent ste";
            EPStatement          stmt           = epService.EPAdministrator.CreateEPL(epl);
            SampleUpdateListener sampleListener = new SampleUpdateListener();

            stmt.Events += sampleListener.Update;

            epService.EPRuntime.SendEvent(new SampleTriggerEvent("sample1"));
            Log.Info("Subquery returned: " + sampleListener.LastEvent.Get("key2"));
            // For assertions against expected results please see the regression test suite
        }
        private void RunSubquerySample(EPRuntime runtime)
        {
            var epl            = "select (select key2 from MySampleWindow where key1 = ste.triggerKey) as key2 from SampleTriggerEvent ste";
            var stmt           = CompileDeploy(runtime, epl);
            var sampleListener = new SampleUpdateListener();

            stmt.Events += sampleListener.Update;

            runtime.EventService.SendEventBean(new SampleTriggerEvent("sample1"), "SampleTriggerEvent");
            Log.Info("Subquery returned: " + sampleListener.LastEvent.Get("key2"));
            // For assertions against expected results please see the regression test suite
        }
Example #3
0
        private void RunJoinSample(EPServiceProvider epService)
        {
            String epl = "select sw.* " +
                         "from SampleJoinEvent#lastevent() sje, MySampleWindow sw " +
                         "where sw.key1 = sje.propOne and sw.key2 = sje.propTwo";
            EPStatement          stmt           = epService.EPAdministrator.CreateEPL(epl);
            SampleUpdateListener sampleListener = new SampleUpdateListener();

            stmt.Events += sampleListener.Update;

            epService.EPRuntime.SendEvent(new SampleJoinEvent("sample1", "sample2")); // see values in SampleVirtualDataWindowIndex
            Log.Info("Join query returned: " + sampleListener.LastEvent.Get("key1") + " and " + sampleListener.LastEvent.Get("key2"));

            // For assertions against expected results please see the regression test suite
        }
        private void RunJoinSample(EPRuntime runtime)
        {
            var epl = "select sw.* " +
                      "from SampleJoinEvent#lastevent() sje, MySampleWindow sw " +
                      "where sw.Key1 = sje.propOne and sw.Key2 = sje.propTwo";
            EPStatement stmt           = CompileDeploy(runtime, epl);
            var         sampleListener = new SampleUpdateListener();

            stmt.Events += sampleListener.Update;

            runtime.EventService.SendEventBean(new SampleJoinEvent("sample1", "sample2"), "SampleJoinEvent"); // see values in SampleVirtualDataWindowIndex
            Log.Info("Join query returned: " + sampleListener.LastEvent.Get("key1") + " and " + sampleListener.LastEvent.Get("key2"));

            // For assertions against expected results please see the regression test suite
        }
Example #5
0
        private void RunSampleOnMerge(EPServiceProvider epService)
        {
            String onDelete =
                "on SampleMergeEvent " +
                "merge MySampleWindow " +
                "where key1 = propOne " +
                "when not matched then insert select propOne as key1, propTwo as key2, 0 as value1, 0d as value2 " +
                "when matched then update set key2 = propTwo";

            EPStatement          stmt           = epService.EPAdministrator.CreateEPL(onDelete);
            SampleUpdateListener sampleListener = new SampleUpdateListener();

            stmt.Events += sampleListener.Update;

            // not-matching case
            epService.EPRuntime.SendEvent(new SampleMergeEvent("mykey-sample", "hello"));
            Log.Info("Received inserted key: " + sampleListener.LastEvent.Get("key1") + " and " + sampleListener.LastEvent.Get("key2"));

            // matching case
            epService.EPRuntime.SendEvent(new SampleMergeEvent("sample1", "newvalue"));  // see values in SampleVirtualDataWindowIndex
            Log.Info("Received updated key: " + sampleListener.LastEvent.Get("key1") + " and " + sampleListener.LastEvent.Get("key2"));

            // For assertions against expected results please see the regression test suite
        }
        private void RunSampleOnMerge(EPRuntime runtime)
        {
            var onDelete =
                "on SampleMergeEvent " +
                "merge MySampleWindow " +
                "where key1 = propOne " +
                "when not matched then insert select propOne as key1, propTwo as key2, 0 as value1, 0d as value2 " +
                "when matched then update set key2 = propTwo";

            var stmt           = CompileDeploy(runtime, onDelete);
            var sampleListener = new SampleUpdateListener();

            stmt.Events += sampleListener.Update;

            // not-matching case
            runtime.EventService.SendEventBean(new SampleMergeEvent("mykey-sample", "hello"), "SampleMergeEvent");
            Log.Info("Received inserted key: " + sampleListener.LastEvent.Get("key1") + " and " + sampleListener.LastEvent.Get("key2"));

            // matching case
            runtime.EventService.SendEventBean(new SampleMergeEvent("sample1", "newvalue"), "SampleMergeEvent");  // see values in SampleVirtualDataWindowIndex
            Log.Info("Received updated key: " + sampleListener.LastEvent.Get("key1") + " and " + sampleListener.LastEvent.Get("key2"));

            // For assertions against expected results please see the regression test suite
        }