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


Java SupportSubscriberMRD类代码示例

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


SupportSubscriberMRD类属于com.espertech.esper.client.scopetest包,在下文中一共展示了SupportSubscriberMRD类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runAssertionSubscriberOnly

import com.espertech.esper.client.scopetest.SupportSubscriberMRD; //导入依赖的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

示例2: run

import com.espertech.esper.client.scopetest.SupportSubscriberMRD; //导入依赖的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

示例3: setUp

import com.espertech.esper.client.scopetest.SupportSubscriberMRD; //导入依赖的package包/类
public void setUp()
{
    epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    subscriber = new SupportSubscriberMRD();
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:8,代码来源:TestDistinctWildcardJoinPattern.java

示例4: testSubscriberOnly

import com.espertech.esper.client.scopetest.SupportSubscriberMRD; //导入依赖的package包/类
public void testSubscriberOnly()
{
    SupportSubscriberMRD subscriber = new SupportSubscriberMRD();
    sendTimer(0);
    EPStatement stmt = epService.getEPAdministrator().createEPL("select irstream theString,intPrimitive from SupportBean.win: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(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.win: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(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]);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:35,代码来源:TestForGroupDelivery.java


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