本文整理汇总了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();
}
示例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();
}