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


Java EPDataFlowInstanceCaptive类代码示例

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


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

示例1: runAssertionAllTypes

import com.espertech.esper.client.dataflow.EPDataFlowInstanceCaptive; //导入依赖的package包/类
private void runAssertionAllTypes(EPServiceProvider epService) throws Exception {
    DefaultSupportGraphEventUtil.addTypeConfiguration(epService);

    runAssertionAllTypes(epService, "MyXMLEvent", DefaultSupportGraphEventUtil.getXMLEvents());
    runAssertionAllTypes(epService, "MyOAEvent", DefaultSupportGraphEventUtil.getOAEvents());
    runAssertionAllTypes(epService, "MyMapEvent", DefaultSupportGraphEventUtil.getMapEvents());
    runAssertionAllTypes(epService, "MyEvent", DefaultSupportGraphEventUtil.getPOJOEvents());

    // test doc sample
    String epl = "create dataflow MyDataFlow\n" +
            "  create schema SampleSchema(tagId string, locX double),\t// sample type\n" +
            "  BeaconSource -> samplestream<SampleSchema> {}\n" +
            "  \n" +
            "  // Filter all events that have a tag id of '001'\n" +
            "  Filter(samplestream) -> tags_001 {\n" +
            "    filter : tagId = '001' \n" +
            "  }\n" +
            "  \n" +
            "  // Filter all events that have a tag id of '001', putting all other tags into the second stream\n" +
            "  Filter(samplestream) -> tags_001, tags_other {\n" +
            "    filter : tagId = '001' \n" +
            "  }";
    epService.getEPAdministrator().createEPL(epl);
    epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlow");

    // test two streams
    DefaultSupportCaptureOpStatic.getInstances().clear();
    String graph = "create dataflow MyFilter\n" +
            "Emitter -> sb<SupportBean> {name : 'e1'}\n" +
            "Filter(sb) -> out.ok, out.fail {filter: theString = 'x'}\n" +
            "DefaultSupportCaptureOpStatic(out.ok) {}" +
            "DefaultSupportCaptureOpStatic(out.fail) {}";
    epService.getEPAdministrator().createEPL(graph);

    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyFilter");
    EPDataFlowInstanceCaptive captive = instance.startCaptive();

    captive.getEmitters().get("e1").submit(new SupportBean("x", 10));
    captive.getEmitters().get("e1").submit(new SupportBean("y", 11));
    assertEquals(10, ((SupportBean) DefaultSupportCaptureOpStatic.getInstances().get(0).getCurrent().get(0)).getIntPrimitive());
    assertEquals(11, ((SupportBean) DefaultSupportCaptureOpStatic.getInstances().get(1).getCurrent().get(0)).getIntPrimitive());
    DefaultSupportCaptureOpStatic.getInstances().clear();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:44,代码来源:ExecDataflowOpFilter.java

示例2: testAllTypes

import com.espertech.esper.client.dataflow.EPDataFlowInstanceCaptive; //导入依赖的package包/类
public void testAllTypes() throws Exception
{
    DefaultSupportGraphEventUtil.addTypeConfiguration(epService);

    runAssertionAllTypes("MyXMLEvent", DefaultSupportGraphEventUtil.getXMLEvents());
    runAssertionAllTypes("MyOAEvent", DefaultSupportGraphEventUtil.getOAEvents());
    runAssertionAllTypes("MyMapEvent", DefaultSupportGraphEventUtil.getMapEvents());
    runAssertionAllTypes("MyEvent", DefaultSupportGraphEventUtil.getPOJOEvents());

    // test doc sample
    String epl = "create dataflow MyDataFlow\n" +
            "  create schema SampleSchema(tagId string, locX double),\t// sample type\n" +
            "  BeaconSource -> samplestream<SampleSchema> {}\n" +
            "  \n" +
            "  // Filter all events that have a tag id of '001'\n" +
            "  Filter(samplestream) -> tags_001 {\n" +
            "    filter : tagId = '001' \n" +
            "  }\n" +
            "  \n" +
            "  // Filter all events that have a tag id of '001', putting all other tags into the second stream\n" +
            "  Filter(samplestream) -> tags_001, tags_other {\n" +
            "    filter : tagId = '001' \n" +
            "  }";
    epService.getEPAdministrator().createEPL(epl);
    epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlow");

    // test two streams
    DefaultSupportCaptureOpStatic.getInstances().clear();
    String graph = "create dataflow MyFilter\n" +
            "Emitter -> sb<SupportBean> {name : 'e1'}\n" +
            "Filter(sb) -> out.ok, out.fail {filter: theString = 'x'}\n" +
            "DefaultSupportCaptureOpStatic(out.ok) {}" +
            "DefaultSupportCaptureOpStatic(out.fail) {}";
    epService.getEPAdministrator().createEPL(graph);

    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyFilter");
    EPDataFlowInstanceCaptive captive = instance.startCaptive();

    captive.getEmitters().get("e1").submit(new SupportBean("x", 10));
    captive.getEmitters().get("e1").submit(new SupportBean("y", 11));
    assertEquals(10, ((SupportBean) DefaultSupportCaptureOpStatic.getInstances().get(0).getCurrent().get(0)).getIntPrimitive());
    assertEquals(11, ((SupportBean) DefaultSupportCaptureOpStatic.getInstances().get(1).getCurrent().get(0)).getIntPrimitive());
    DefaultSupportCaptureOpStatic.getInstances().clear();
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:45,代码来源:TestDataFlowOpFilter.java


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