當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。