当前位置: 首页>>代码示例>>Java>>正文


Java EPServiceProvider.getEPServiceIsolated方法代码示例

本文整理汇总了Java中com.espertech.esper.client.EPServiceProvider.getEPServiceIsolated方法的典型用法代码示例。如果您正苦于以下问题:Java EPServiceProvider.getEPServiceIsolated方法的具体用法?Java EPServiceProvider.getEPServiceIsolated怎么用?Java EPServiceProvider.getEPServiceIsolated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.espertech.esper.client.EPServiceProvider的用法示例。


在下文中一共展示了EPServiceProvider.getEPServiceIsolated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runAssertionOutputLimit

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionOutputLimit(EPServiceProvider epService, long startTime, String size, long flipTime, long repeatTime) {

        EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("isolated");
        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime));

        SupportUpdateListener listener = new SupportUpdateListener();
        EPStatement stmt = isolated.getEPAdministrator().createEPL("select * from SupportBean output every " + size + " seconds", "s0", null);
        stmt.addListener(listener);

        isolated.getEPRuntime().sendEvent(new SupportBean("E1", 10));
        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
        assertFalse(listener.isInvoked());

        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
        assertTrue(listener.getIsInvokedAndReset());

        isolated.getEPRuntime().sendEvent(new SupportBean("E2", 10));
        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(repeatTime + flipTime - 1));
        assertFalse(listener.isInvoked());

        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(repeatTime + flipTime));
        assertTrue(listener.getIsInvokedAndReset());

        isolated.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ExecOutputLimitMicrosecondResolution.java

示例2: runAssertionPattern

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionPattern(EPServiceProvider epService, long startTime, String patternExpr, long... flipTimes) {

        EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("iso");
        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime));

        SupportUpdateListener listener = new SupportUpdateListener();
        EPStatement stmt = isolated.getEPAdministrator().createEPL("select * from pattern[" + patternExpr + "]", "s0", null);
        stmt.addListener(listener);

        int count = 0;
        for (long flipTime : flipTimes) {
            isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
            assertFalse("Failed for flip " + count, listener.getAndClearIsInvoked());

            isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
            assertTrue("Failed for flip " + count, listener.getAndClearIsInvoked());
            count++;
        }

        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(Long.MAX_VALUE));
        assertFalse(listener.getAndClearIsInvoked());

        isolated.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecPatternMicrosecondResolution.java

示例3: runAssertionWithTime

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionWithTime(EPServiceProvider epService, long startTime, long flipTime) {
    EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("isolated");
    isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime));

    String text = "select * from SupportBean " +
            "match_recognize (" +
            " measures A as a" +
            " pattern (A*)" +
            " interval 10 seconds" +
            ")";

    EPStatement stmt = isolated.getEPAdministrator().createEPL(text, "s0", null);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    isolated.getEPRuntime().sendEvent(new SupportBean("E1", 1));

    isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
    assertFalse(listener.getIsInvokedAndReset());

    isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
    assertTrue(listener.getIsInvokedAndReset());

    isolated.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ExecRowRecogIntervalMicrosecondResolution.java

示例4: runAssertionEventTime

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private static void runAssertionEventTime(EPServiceProvider epService, long flipTime) {

        EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("isolated");
        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(0));

        String epl = "@Hint('reclaim_group_aged=1,reclaim_group_freq=5') select * from SupportBean#groupwin(theString)#keepall";
        EPStatement stmt = isolated.getEPAdministrator().createEPL(epl, "s0", null);

        isolated.getEPRuntime().sendEvent(new SupportBean("E1", 0));
        assertCount(stmt, 1);

        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
        isolated.getEPRuntime().sendEvent(new SupportBean("E2", 0));
        assertCount(stmt, 2);

        isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
        isolated.getEPRuntime().sendEvent(new SupportBean("E3", 0));
        assertCount(stmt, 2);

        isolated.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecViewGroupWinReclaimMicrosecondResolution.java

示例5: runAssertionTimeWindow

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionTimeWindow(EPServiceProvider epService, long startTime, String size, long flipTime) {
    EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("isolated");
    isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(startTime));

    String[] fields = "theString".split(",");
    EPStatement stmt = isolated.getEPAdministrator().createEPL("select * from SupportBean#time(" + size + ")", "s0", 0);

    isolated.getEPRuntime().sendEvent(new SupportBean("E1", 1));

    isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime - 1));
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][]{{"E1"}});

    isolated.getEPRuntime().sendEvent(new CurrentTimeEvent(flipTime));
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);

    isolated.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecViewTimeWindowMicrosecondResolution.java

示例6: runAssertionFullFormUnlimitedPastDatedAnchoring

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionFullFormUnlimitedPastDatedAnchoring(EPServiceProvider epService) {

        EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");

        // Repeat unlimited number of times, reference-dated to "1980-01-01T00:00:00Z" (UTC), period of 1 second
        sendCurrentTime(iso, "2012-01-01T00:0:00.000GMT-0:00");
        String epl = "select * from pattern[every timer:schedule(iso:'R/1980-01-01T00:00:00Z/PT10S')]";
        SupportUpdateListener listener = new SupportUpdateListener();
        iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

        sendCurrentTime(iso, "2012-01-01T00:0:15.000GMT-0:00");
        assertTrue(listener.getIsInvokedAndReset());

        sendCurrentTime(iso, "2012-01-01T00:0:20.000GMT-0:00");
        assertTrue(listener.getIsInvokedAndReset());

        assertReceivedAtTime(listener, iso, "2012-01-01T00:0:30.000GMT-0:00");

        sendCurrentTime(iso, "2012-01-01T00:0:55.000GMT-0:00");
        assertTrue(listener.getIsInvokedAndReset());

        assertReceivedAtTime(listener, iso, "2012-01-01T00:1:00.000GMT-0:00");

        epService.getEPAdministrator().destroyAllStatements();
        iso.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:27,代码来源:ExecPatternObserverTimerSchedule.java

示例7: runAssertionRecurringAnchoring

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionRecurringAnchoring(EPServiceProvider epService) {
    EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");

    // Repeat unlimited number of times, reference-dated to "1980-01-01T00:00:00Z" (UTC), period of 1 second
    sendCurrentTime(iso, "2012-01-01T00:0:00.000GMT-0:00");
    String epl = "select * from pattern[every timer:schedule(iso: 'R/PT10S')]";
    SupportUpdateListener listener = new SupportUpdateListener();
    iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

    sendCurrentTime(iso, "2012-01-01T00:0:15.000GMT-0:00");
    assertTrue(listener.getIsInvokedAndReset());

    sendCurrentTime(iso, "2012-01-01T00:0:20.000GMT-0:00");
    assertTrue(listener.getIsInvokedAndReset());

    assertReceivedAtTime(listener, iso, "2012-01-01T00:0:30.000GMT-0:00");

    sendCurrentTime(iso, "2012-01-01T00:0:55.000GMT-0:00");
    assertTrue(listener.getIsInvokedAndReset());

    assertReceivedAtTime(listener, iso, "2012-01-01T00:1:00.000GMT-0:00");

    epService.getEPAdministrator().destroyAllStatements();
    iso.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:26,代码来源:ExecPatternObserverTimerSchedule.java

示例8: runAssertionFullFormUnlimitedFutureDated

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionFullFormUnlimitedFutureDated(EPServiceProvider epService) {
    EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");

    // Repeat unlimited number of times, reference-dated to future date, period of 1 day
    sendCurrentTime(iso, "2012-10-01T05:52:00.000GMT-0:00");
    String epl = "select * from pattern[every timer:schedule(iso: 'R/2013-01-01T02:00:05Z/P1D')]";
    SupportUpdateListener listener = new SupportUpdateListener();
    iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

    assertReceivedAtTime(listener, iso, "2013-01-01T02:00:05.000GMT-0:00");
    assertReceivedAtTime(listener, iso, "2013-01-02T02:00:05.000GMT-0:00");
    assertReceivedAtTime(listener, iso, "2013-01-03T02:00:05.000GMT-0:00");
    assertReceivedAtTime(listener, iso, "2013-01-04T02:00:05.000GMT-0:00");

    epService.getEPAdministrator().destroyAllStatements();
    iso.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecPatternObserverTimerSchedule.java

示例9: runSequenceIsolated

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runSequenceIsolated(EPServiceProvider epService, String startTime, String epl, String[] times) {
    EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("i1");
    sendTime(isolated, startTime);
    SupportUpdateListener listener = new SupportUpdateListener();
    isolated.getEPAdministrator().createEPL(epl, "S0", null).addListener(listener);
    runSequence(isolated, times, listener);
    epService.getEPAdministrator().destroyAllStatements();
    isolated.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:10,代码来源:ExecPatternCronParameter.java

示例10: runAssertionFollowedBy

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionFollowedBy(EPServiceProvider epService) {
    EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");
    sendCurrentTime(iso, "2012-10-01T05:51:07.000GMT-0:00");

    String epl = "select * from pattern[every sb=SupportBean -> timer:schedule(iso: 'R/1980-01-01T00:00:00Z/PT15S')]";
    SupportUpdateListener listener = new SupportUpdateListener();
    iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

    SupportBean b1 = makeSendEvent(iso, "E1");

    sendCurrentTime(iso, "2012-10-01T05:51:14.999GMT-0:00");
    assertFalse(listener.getIsInvokedAndReset());

    sendCurrentTime(iso, "2012-10-01T05:51:15.000GMT-0:00");
    assertEquals(b1, listener.assertOneGetNewAndReset().get("sb"));

    sendCurrentTime(iso, "2012-10-01T05:51:16.000GMT-0:00");
    SupportBean b2 = makeSendEvent(iso, "E2");

    sendCurrentTime(iso, "2012-10-01T05:51:18.000GMT-0:00");
    SupportBean b3 = makeSendEvent(iso, "E3");

    sendCurrentTime(iso, "2012-10-01T05:51:30.000GMT-0:00");
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), "sb".split(","), new Object[][]{{b2}, {b3}});

    epService.getEPAdministrator().destroyAllStatements();
    iso.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:29,代码来源:ExecPatternObserverTimerSchedule.java

示例11: tryAssertionDateWithPeriod

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void tryAssertionDateWithPeriod(EPServiceProvider epService, String parameters) {
    EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");
    sendCurrentTime(iso, "2012-10-01T05:51:00.000GMT-0:00");

    // Repeat 3 times, starting "2012-10-01T05:52:00Z" (UTC), period of 2 seconds
    String epl = "select * from pattern[timer:schedule(" + parameters + ")]";
    SupportUpdateListener listener = new SupportUpdateListener();
    iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

    assertReceivedAtTime(listener, iso, "2012-10-01T05:52:02.000GMT-0:00");
    assertSendNoMoreCallback(listener, iso, "2012-10-01T05:52:04.000GMT-0:00");

    epService.getEPAdministrator().destroyAllStatements();
    iso.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:16,代码来源:ExecPatternObserverTimerSchedule.java

示例12: tryAssertionJustFutureDate

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void tryAssertionJustFutureDate(EPServiceProvider epService, boolean hasEvery, String parameters) {
    EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");
    sendCurrentTime(iso, "2012-10-01T05:51:00.000GMT-0:00");

    // Fire once at "2012-10-01T05:52:00Z" (UTC)
    String epl = "select * from pattern[" + (hasEvery ? "every " : "") + "timer:schedule(" + parameters + ")]";
    SupportUpdateListener listener = new SupportUpdateListener();
    iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

    assertReceivedAtTime(listener, iso, "2012-10-01T05:52:00.000GMT-0:00");
    assertSendNoMoreCallback(listener, iso, "2012-10-01T05:53:00.000GMT-0:00");

    epService.getEPAdministrator().destroyAllStatements();
    iso.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:16,代码来源:ExecPatternObserverTimerSchedule.java

示例13: runAssertion_A_Bstar_or_C

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertion_A_Bstar_or_C(EPServiceProvider epService) {

        EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("I1");
        sendTimer(isolated, 0);

        String[] fields = "a,b0,b1,b2,c".split(",");
        String text = "select * from MyEvent#keepall " +
                "match_recognize (" +
                " measures A.theString as a, B[0].theString as b0, B[1].theString as b1, B[2].theString as b2, C.theString as c " +
                " pattern (A (B* | C))" +
                " interval 10 seconds or terminated" +
                " define" +
                " A as A.theString like 'A%'," +
                " B as B.theString like 'B%'," +
                " C as C.theString like 'C%'" +
                ")";

        EPStatement stmt = isolated.getEPAdministrator().createEPL(text, "stmt1", null);
        SupportUpdateListener listener = new SupportUpdateListener();
        stmt.addListener(listener);

        isolated.getEPRuntime().sendEvent(new SupportRecogBean("A1"));
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("C1"));
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A1", null, null, null, "C1"});

        isolated.getEPRuntime().sendEvent(new SupportRecogBean("A2"));
        assertFalse(listener.isInvoked());
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("B1"));
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A2", null, null, null, null});

        isolated.getEPRuntime().sendEvent(new SupportRecogBean("B2"));
        assertFalse(listener.isInvoked());
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("X1"));
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A2", "B1", "B2", null, null});

        isolated.getEPRuntime().sendEvent(new SupportRecogBean("A3"));
        sendTimer(isolated, 10000);
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A3", null, null, null, null});

        sendTimer(isolated, Integer.MAX_VALUE);
        assertFalse(listener.isInvoked());

        // destroy
        stmt.destroy();
        isolated.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:47,代码来源:ExecRowRecogIntervalOrTerminated.java

示例14: runAssertionFollowedByDynamicallyComputed

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertionFollowedByDynamicallyComputed(EPServiceProvider epService) {

        epService.getEPAdministrator().getConfiguration().addPlugInSingleRowFunction("computeISO8601String", this.getClass().getName(), "computeISO8601String");

        EPServiceProviderIsolated iso = epService.getEPServiceIsolated("E1");
        sendCurrentTime(iso, "2012-10-01T05:51:07.000GMT-0:00");

        String epl = "select * from pattern[every sb=SupportBean -> timer:schedule(iso: computeISO8601String(sb))]";
        SupportUpdateListener listener = new SupportUpdateListener();
        iso.getEPAdministrator().createEPL(epl, null, null).addListener(listener);

        SupportBean b1 = makeSendEvent(iso, "E1", 5);

        sendCurrentTime(iso, "2012-10-01T05:51:9.999GMT-0:00");
        assertFalse(listener.getIsInvokedAndReset());

        sendCurrentTime(iso, "2012-10-01T05:51:10.000GMT-0:00");
        assertEquals(b1, listener.assertOneGetNewAndReset().get("sb"));

        epService.getEPAdministrator().destroyAllStatements();
        iso.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecPatternObserverTimerSchedule.java

示例15: runAssertion_A_Bstar

import com.espertech.esper.client.EPServiceProvider; //导入方法依赖的package包/类
private void runAssertion_A_Bstar(EPServiceProvider epService, boolean allMatches) {

        EPServiceProviderIsolated isolated = epService.getEPServiceIsolated("I1");
        sendTimer(isolated, 0);

        String[] fields = "a,b0,b1,b2".split(",");
        String text = "select * from MyEvent#keepall " +
                "match_recognize (" +
                " measures A.theString as a, B[0].theString as b0, B[1].theString as b1, B[2].theString as b2" +
                (allMatches ? " all matches" : "") +
                " pattern (A B*)" +
                " interval 10 seconds or terminated" +
                " define" +
                " A as A.theString like \"A%\"," +
                " B as B.theString like \"B%\"" +
                ")";

        EPStatement stmt = isolated.getEPAdministrator().createEPL(text, "stmt1", null);
        SupportUpdateListener listener = new SupportUpdateListener();
        stmt.addListener(listener);

        // test output by terminated because of misfit event
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("A1"));
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("B1"));
        assertFalse(listener.isInvoked());
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("X1"));
        if (!allMatches) {
            EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A1", "B1", null, null});
        } else {
            EPAssertionUtil.assertPropsPerRowAnyOrder(listener.getAndResetLastNewData(), fields,
                    new Object[][]{{"A1", "B1", null, null}, {"A1", null, null, null}});
        }

        sendTimer(isolated, 20000);
        assertFalse(listener.isInvoked());

        // test output by timer expiry
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("A2"));
        isolated.getEPRuntime().sendEvent(new SupportRecogBean("B2"));
        assertFalse(listener.isInvoked());
        sendTimer(isolated, 29999);

        sendTimer(isolated, 30000);
        if (!allMatches) {
            EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"A2", "B2", null, null});
        } else {
            EPAssertionUtil.assertPropsPerRowAnyOrder(listener.getAndResetLastNewData(), fields,
                    new Object[][]{{"A2", "B2", null, null}, {"A2", null, null, null}});
        }

        // destroy
        stmt.destroy();
        isolated.destroy();

        EPStatement stmtFromModel = SupportModelHelper.compileCreate(epService, text);
        stmtFromModel.destroy();
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:58,代码来源:ExecRowRecogIntervalOrTerminated.java


注:本文中的com.espertech.esper.client.EPServiceProvider.getEPServiceIsolated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。