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


Java EPStatement.setSubscriber方法代码示例

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


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

示例1: runAssertionOutputWhenBuiltInCountInsert

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionOutputWhenBuiltInCountInsert(EPServiceProvider epService) {
    String expression = "select symbol from MarketData#length(2) output when count_insert >= 3";
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    SupportSubscriber subscriber = new SupportSubscriber();
    stmt.setSubscriber(subscriber);

    sendEvent(epService, "S1", 0);
    sendEvent(epService, "S2", 0);
    assertFalse(subscriber.isInvoked());

    sendEvent(epService, "S3", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S1", "S2", "S3"}, subscriber.getAndResetLastNewData());

    sendEvent(epService, "S4", 0);
    sendEvent(epService, "S5", 0);
    assertFalse(subscriber.isInvoked());

    sendEvent(epService, "S6", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S4", "S5", "S6"}, subscriber.getAndResetLastNewData());

    sendEvent(epService, "S7", 0);
    assertFalse(subscriber.isInvoked());

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

示例2: runAssertionOutputWhenBuiltInCountRemove

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionOutputWhenBuiltInCountRemove(EPServiceProvider epService) {
    String expression = "select symbol from MarketData#length(2) output when count_remove >= 2";
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    SupportSubscriber subscriber = new SupportSubscriber();
    stmt.setSubscriber(subscriber);

    sendEvent(epService, "S1", 0);
    sendEvent(epService, "S2", 0);
    sendEvent(epService, "S3", 0);
    assertFalse(subscriber.isInvoked());

    sendEvent(epService, "S4", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S1", "S2", "S3", "S4"}, subscriber.getAndResetLastNewData());

    sendEvent(epService, "S5", 0);
    assertFalse(subscriber.isInvoked());

    sendEvent(epService, "S6", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S5", "S6"}, subscriber.getAndResetLastNewData());

    sendEvent(epService, "S7", 0);
    assertFalse(subscriber.isInvoked());

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

示例3: tryAssertionInsertOA

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryAssertionInsertOA(EPServiceProvider epService) {
    epService.getEPAdministrator().createEPL("create objectarray schema EmptyOASchema()");
    epService.getEPAdministrator().createEPL("insert into EmptyOASchema select null from SupportBean");

    SupportSubscriber supportSubscriber = new SupportSubscriber();
    EPStatement stmt = epService.getEPAdministrator().createEPL("select * from EmptyOASchema");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    stmt.setSubscriber(supportSubscriber);

    epService.getEPRuntime().sendEvent(new SupportBean());
    assertEquals(0, ((Object[]) listener.assertOneGetNewAndReset().getUnderlying()).length);

    Object[] lastNewSubscriberData = supportSubscriber.getLastNewData();
    assertEquals(1, lastNewSubscriberData.length);
    assertEquals(0, ((Object[]) lastNewSubscriberData[0]).length);
    epService.getEPAdministrator().destroyAllStatements();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:19,代码来源:ExecInsertIntoEmptyPropType.java

示例4: runAssertionVariables

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionVariables(EPServiceProvider epService) {
    String[] fields = "myvar".split(",");
    SubscriberMap subscriberCreateVariable = new SubscriberMap();
    String stmtTextCreate = "create variable string myvar = 'abc'";
    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtTextCreate);
    stmt.setSubscriber(subscriberCreateVariable);

    SubscriberMap subscriberSetVariable = new SubscriberMap();
    String stmtTextSet = "on SupportBean set myvar = theString";
    stmt = epService.getEPAdministrator().createEPL(stmtTextSet);
    stmt.setSubscriber(subscriberSetVariable);

    epService.getEPRuntime().sendEvent(new SupportBean("def", 1));
    EPAssertionUtil.assertPropsMap(subscriberCreateVariable.getAndResetIndicate().get(0), fields, new Object[]{"def"});
    EPAssertionUtil.assertPropsMap(subscriberSetVariable.getAndResetIndicate().get(0), fields, new Object[]{"def"});

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

示例5: tryAssertion

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryAssertion(EPServiceProvider epService, int days, EPStatement stmt) {
    SupportSubscriber subscriber = new SupportSubscriber();
    stmt.setSubscriber(subscriber);

    sendEvent(epService, "S1", 0);

    // now scheduled for output
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    assertEquals(0, epService.getEPRuntime().getVariableValue("myvar"));
    assertFalse(subscriber.isInvoked());

    sendTimeEvent(epService, days, 8, 0, 1, 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S1"}, subscriber.getAndResetLastNewData());
    assertEquals(0, epService.getEPRuntime().getVariableValue("myvar"));
    assertEquals(1, epService.getEPRuntime().getVariableValue("count_insert_var"));

    sendEvent(epService, "S2", 0);
    sendEvent(epService, "S3", 0);
    sendTimeEvent(epService, days, 8, 0, 2, 0);
    sendTimeEvent(epService, days, 8, 0, 3, 0);
    epService.getEPRuntime().sendEvent(new SupportBean("E2", 1));
    assertEquals(0, epService.getEPRuntime().getVariableValue("myvar"));
    assertEquals(2, epService.getEPRuntime().getVariableValue("count_insert_var"));

    assertFalse(subscriber.isInvoked());
    sendTimeEvent(epService, days, 8, 0, 4, 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S2", "S3"}, subscriber.getAndResetLastNewData());
    assertEquals(0, epService.getEPRuntime().getVariableValue("myvar"));

    sendTimeEvent(epService, days, 8, 0, 5, 0);
    assertFalse(subscriber.isInvoked());
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    assertEquals(0, epService.getEPRuntime().getVariableValue("myvar"));
    assertFalse(subscriber.isInvoked());

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

示例6: runAssertionOutputWhenExpression

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionOutputWhenExpression(EPServiceProvider epService) {
    sendTimeEvent(epService, 1, 8, 0, 0, 0);
    epService.getEPAdministrator().getConfiguration().addVariable("myint", int.class, 0);
    epService.getEPAdministrator().getConfiguration().addVariable("mystring", String.class, "");
    epService.getEPAdministrator().createEPL("on SupportBean set myint = intPrimitive, mystring = theString");

    String expression = "select symbol from MarketData#length(2) output when myint = 1 and mystring like 'F%'";
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    SupportSubscriber subscriber = new SupportSubscriber();
    stmt.setSubscriber(subscriber);

    sendEvent(epService, "S1", 0);

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    assertEquals(1, epService.getEPRuntime().getVariableValue("myint"));
    assertEquals("E1", epService.getEPRuntime().getVariableValue("mystring"));

    sendEvent(epService, "S2", 0);
    sendTimeEvent(epService, 1, 8, 0, 1, 0);
    assertFalse(subscriber.isInvoked());

    epService.getEPRuntime().sendEvent(new SupportBean("F1", 0));
    assertEquals(0, epService.getEPRuntime().getVariableValue("myint"));
    assertEquals("F1", epService.getEPRuntime().getVariableValue("mystring"));

    sendTimeEvent(epService, 1, 8, 0, 2, 0);
    sendEvent(epService, "S3", 0);
    assertFalse(subscriber.isInvoked());

    epService.getEPRuntime().sendEvent(new SupportBean("F2", 1));
    assertEquals(1, epService.getEPRuntime().getVariableValue("myint"));
    assertEquals("F2", epService.getEPRuntime().getVariableValue("mystring"));

    sendEvent(epService, "S4", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S1", "S2", "S3", "S4"}, subscriber.getAndResetLastNewData());

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

示例7: runAssertionOutputWhenBuiltInLastTimestamp

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionOutputWhenBuiltInLastTimestamp(EPServiceProvider epService) {
    sendTimeEvent(epService, 1, 8, 0, 0, 0);
    String expression = "select symbol from MarketData#length(2) output when current_timestamp - last_output_timestamp >= 2000";
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    SupportSubscriber subscriber = new SupportSubscriber();
    stmt.setSubscriber(subscriber);

    sendEvent(epService, "S1", 0);

    sendTimeEvent(epService, 1, 8, 0, 1, 900);
    sendEvent(epService, "S2", 0);

    sendTimeEvent(epService, 1, 8, 0, 2, 0);
    assertFalse(subscriber.isInvoked());

    sendEvent(epService, "S3", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S1", "S2", "S3"}, subscriber.getAndResetLastNewData());

    sendTimeEvent(epService, 1, 8, 0, 3, 0);
    sendEvent(epService, "S4", 0);

    sendTimeEvent(epService, 1, 8, 0, 3, 500);
    sendEvent(epService, "S5", 0);
    assertFalse(subscriber.isInvoked());

    sendTimeEvent(epService, 1, 8, 0, 4, 0);
    sendEvent(epService, "S6", 0);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"S4", "S5", "S6"}, subscriber.getAndResetLastNewData());

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

示例8: runAssertionSubscriberOnly

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionSubscriberOnly(EPServiceProvider epService) {
    SupportSubscriberMRD subscriber = new SupportSubscriberMRD();
    sendTimer(epService, 0);
    EPStatement stmt = epService.getEPAdministrator().createEPL("select irstream theString,intPrimitive from SupportBean#time_batch(1) for discrete_delivery");
    stmt.setSubscriber(subscriber);

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
    epService.getEPRuntime().sendEvent(new SupportBean("E3", 1));
    sendTimer(epService, 1000);
    assertEquals(3, subscriber.getInsertStreamList().size());
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E1", 1}, subscriber.getInsertStreamList().get(0)[0]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E2", 2}, subscriber.getInsertStreamList().get(1)[0]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E3", 1}, subscriber.getInsertStreamList().get(2)[0]);

    stmt.destroy();
    subscriber.reset();
    stmt = epService.getEPAdministrator().createEPL("select irstream theString,intPrimitive from SupportBean#time_batch(1) for grouped_delivery(intPrimitive)");
    stmt.setSubscriber(subscriber);

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
    epService.getEPRuntime().sendEvent(new SupportBean("E3", 1));
    sendTimer(epService, 2000);
    assertEquals(2, subscriber.getInsertStreamList().size());
    assertEquals(2, subscriber.getRemoveStreamList().size());
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E1", 1}, subscriber.getInsertStreamList().get(0)[0]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E3", 1}, subscriber.getInsertStreamList().get(0)[1]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E2", 2}, subscriber.getInsertStreamList().get(1)[0]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E1", 1}, subscriber.getRemoveStreamList().get(0)[0]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E3", 1}, subscriber.getRemoveStreamList().get(0)[1]);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{"E2", 2}, subscriber.getRemoveStreamList().get(1)[0]);

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

示例9: run

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);

    String epl = "select distinct * from " +
            "SupportBean(intPrimitive=0) as fooB unidirectional " +
            "inner join " +
            "pattern [" +
            "every-distinct(fooA.theString) fooA=SupportBean(intPrimitive=1)" +
            "->" +
            "every-distinct(wooA.theString) wooA=SupportBean(intPrimitive=2)" +
            " where timer:within(1 hour)" +
            "]#time(1 hour) as fooWooPair " +
            "on fooB.longPrimitive = fooWooPair.fooA.longPrimitive" +
            " order by fooWooPair.wooA.theString asc";

    EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
    SupportSubscriberMRD subscriber = new SupportSubscriberMRD();
    stmt.setSubscriber(subscriber);

    sendEvent(epService, "E1", 1, 10L);
    sendEvent(epService, "E2", 2, 10L);
    sendEvent(epService, "E3", 2, 10L);
    sendEvent(epService, "Query", 0, 10L);

    assertTrue(subscriber.isInvoked());
    assertEquals(1, subscriber.getInsertStreamList().size());
    Object[][] inserted = subscriber.getInsertStreamList().get(0);
    assertEquals(2, inserted.length);
    assertEquals("Query", ((SupportBean) inserted[0][0]).getTheString());
    assertEquals("Query", ((SupportBean) inserted[1][0]).getTheString());
    Map mapOne = (Map) inserted[0][1];
    assertEquals("E2", ((EventBean) mapOne.get("wooA")).get("theString"));
    assertEquals("E1", ((EventBean) mapOne.get("fooA")).get("theString"));
    Map mapTwo = (Map) inserted[1][1];
    assertEquals("E3", ((EventBean) mapTwo.get("wooA")).get("theString"));
    assertEquals("E1", ((EventBean) mapTwo.get("fooA")).get("theString"));
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:38,代码来源:ExecEPLDistinctWildcardJoinPattern.java

示例10: run

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {
    EPStatement stmt = epService.getEPAdministrator().createEPL("select sleepaLittle(100) from MyEvent");
    stmt.setSubscriber(new MySubscriber());
    for (int i = 0; i < 10000; i++) {
        epService.getEPRuntime().sendEvent(new MyEvent());
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:8,代码来源:ExecClientThreadedConfigInboundFastShutdown.java

示例11: runAssertionStartStopStatement

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionStartStopStatement(EPServiceProvider epService) {
    SubscriberInterface subscriber = new SubscriberInterface();
    EPStatement stmt = epService.getEPAdministrator().createEPL("select * from SupportMarkerInterface");
    stmt.setSubscriber(subscriber);

    SupportBean_A a1 = new SupportBean_A("A1");
    epService.getEPRuntime().sendEvent(a1);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{a1}, subscriber.getAndResetIndicate().toArray());

    SupportBean_B b1 = new SupportBean_B("B1");
    epService.getEPRuntime().sendEvent(b1);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{b1}, subscriber.getAndResetIndicate().toArray());

    stmt.stop();

    SupportBean_C c1 = new SupportBean_C("C1");
    epService.getEPRuntime().sendEvent(c1);
    assertEquals(0, subscriber.getAndResetIndicate().size());

    stmt.start();

    SupportBean_D d1 = new SupportBean_D("D1");
    epService.getEPRuntime().sendEvent(d1);
    EPAssertionUtil.assertEqualsExactOrder(new Object[]{d1}, subscriber.getAndResetIndicate().toArray());

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

示例12: tryAssertionNamedWindow

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryAssertionNamedWindow(EPServiceProvider epService, EventRepresentationChoice eventRepresentationEnum) {
    String[] fields = "key,value".split(",");
    SubscriberMap subscriberNamedWindow = new SubscriberMap();
    String stmtTextCreate = eventRepresentationEnum.getAnnotationText() + " create window MyWindow#keepall as select theString as key, intPrimitive as value from SupportBean";
    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtTextCreate);
    stmt.setSubscriber(subscriberNamedWindow);

    SubscriberFields subscriberInsertInto = new SubscriberFields();
    String stmtTextInsertInto = "insert into MyWindow select theString as key, intPrimitive as value from SupportBean";
    stmt = epService.getEPAdministrator().createEPL(stmtTextInsertInto);
    stmt.setSubscriber(subscriberInsertInto);

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    EPAssertionUtil.assertPropsMap(subscriberNamedWindow.getAndResetIndicate().get(0), fields, new Object[]{"E1", 1});
    EPAssertionUtil.assertEqualsExactOrder(new Object[][]{{"E1", 1}}, subscriberInsertInto.getAndResetIndicate());

    // test on-delete
    SubscriberMap subscriberDelete = new SubscriberMap();
    String stmtTextDelete = "on SupportMarketDataBean s0 delete from MyWindow s1 where s0.symbol = s1.key";
    stmt = epService.getEPAdministrator().createEPL(stmtTextDelete);
    stmt.setSubscriber(subscriberDelete);

    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("E1", 0, 1L, ""));
    EPAssertionUtil.assertPropsMap(subscriberDelete.getAndResetIndicate().get(0), fields, new Object[]{"E1", 1});

    // test on-select
    SubscriberMap subscriberSelect = new SubscriberMap();
    String stmtTextSelect = "on SupportMarketDataBean s0 select key, value from MyWindow s1";
    stmt = epService.getEPAdministrator().createEPL(stmtTextSelect);
    stmt.setSubscriber(subscriberSelect);

    epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("M1", 0, 1L, ""));
    EPAssertionUtil.assertPropsMap(subscriberSelect.getAndResetIndicate().get(0), fields, new Object[]{"E2", 2});

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

示例13: runAssertionMathContextDivide

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionMathContextDivide(EPServiceProvider epService) {
    // cast and divide
    EPStatement stmtDivide = epService.getEPAdministrator().createEPL("Select cast(1.6, BigDecimal) / cast(9.2, BigDecimal) from SupportBean");
    stmtDivide.setSubscriber(new Object() {
        public void update(BigDecimal value) {
            assertEquals(0.1739130d, value.doubleValue());
        }
    });
    epService.getEPRuntime().sendEvent(new SupportBean());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:11,代码来源:ExecExprBigNumberSupportMathContext.java

示例14: setEPStatement

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
/**
 * Sets the native Esper statement. Typically created by an Esper Template.
 * 
 * @param epStatement
 *            the underlying native Esper statement
 * @see org.opencredo.esper.EsperTemplate
 */
void setEPStatement(EPStatement epStatement) {
	this.epStatement = epStatement;
	if (this.subscriber != null && this.subscriberMethodName == null) {
		epStatement.setSubscriber(this.subscriber);
	} else if (this.subscriber != null && this.subscriberMethodName != null) {
		epStatement.setSubscriber(this.subscriber, subscriberMethodName);
	} else {
		for (UpdateListener listener : listeners) {
			epStatement.addListener(listener);
		}
	}
}
 
开发者ID:sdcuike,项目名称:esper-2015,代码行数:20,代码来源:EsperStatement.java

示例15: run

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {

        sendTimer(epService, 0);

        epService.getEPAdministrator().createEPL("select * from SupportBean(intPrimitive = 1)#keepall", "GroupOne");
        EPStatement stmt = epService.getEPAdministrator().createEPL("select * from SupportBean(intPrimitive = 2)#keepall", "GroupTwo");
        stmt.setSubscriber(new SupportSubscriber());
        epService.getEPAdministrator().createEPL("select * from SupportBean(intPrimitive = 3)#keepall", "Default");   // no listener

        stmt = epService.getEPAdministrator().createEPL("select * from " + StatementMetric.class.getName(), "StmtMetrics");
        SupportUpdateListener listener = new SupportUpdateListener();
        stmt.addListener(listener);

        sendTimer(epService, 6000);
        sendTimer(epService, 7000);
        assertFalse(listener.isInvoked());

        sendTimer(epService, 8000);
        String[] fields = "statementName,numOutputIStream,numInput".split(",");
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"GroupOne", 0L, 0L});

        sendTimer(epService, 12000);
        sendTimer(epService, 14000);
        sendTimer(epService, 15999);
        assertFalse(listener.isInvoked());

        sendTimer(epService, 16000);
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"GroupOne", 0L, 0L});

        // should report as groupTwo
        epService.getEPRuntime().sendEvent(new SupportBean("E1", 2));
        sendTimer(epService, 17999);
        assertFalse(listener.isInvoked());

        sendTimer(epService, 18000);
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"GroupTwo", 1L, 1L});

        // should report as groupTwo
        epService.getEPRuntime().sendEvent(new SupportBean("E1", 3));
        sendTimer(epService, 20999);
        assertFalse(listener.isInvoked());

        sendTimer(epService, 21000);
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"Default", 0L, 1L});

        // turn off group 1
        epService.getEPAdministrator().getConfiguration().setMetricsReportingInterval("GroupOneStatements", -1);
        sendTimer(epService, 24000);
        assertFalse(listener.isInvoked());

        // turn on group 1
        epService.getEPAdministrator().getConfiguration().setMetricsReportingInterval("GroupOneStatements", 1000);
        sendTimer(epService, 25000);
        EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"GroupOne", 0L, 0L});
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:56,代码来源:ExecClientMetricsReportingStmtGroups.java


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