本文整理汇总了Java中com.espertech.esper.client.dataflow.EPDataFlowDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java EPDataFlowDescriptor类的具体用法?Java EPDataFlowDescriptor怎么用?Java EPDataFlowDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EPDataFlowDescriptor类属于com.espertech.esper.client.dataflow包,在下文中一共展示了EPDataFlowDescriptor类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runAssertionCreateStartStop
import com.espertech.esper.client.dataflow.EPDataFlowDescriptor; //导入依赖的package包/类
private void runAssertionCreateStartStop(EPServiceProvider epService) throws Exception {
String epl = "@Name('Create-A-Flow') create dataflow MyGraph Emitter -> outstream<?> {}";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
EPDataFlowRuntime dfruntime = epService.getEPRuntime().getDataFlowRuntime();
EPAssertionUtil.assertEqualsAnyOrder(new String[]{"MyGraph"}, dfruntime.getDataFlows());
EPDataFlowDescriptor desc = dfruntime.getDataFlow("MyGraph");
assertEquals("MyGraph", desc.getDataFlowName());
assertEquals(EPStatementState.STARTED, desc.getStatementState());
assertEquals("Create-A-Flow", desc.getStatementName());
dfruntime.instantiate("MyGraph");
// test duplicate
tryInvalidCompile(epService, epl, "Error starting statement: Data flow by name 'MyGraph' has already been declared [");
// stop - can no longer instantiate but still exists
stmt.stop(); // not removed
assertEquals(EPStatementState.STOPPED, dfruntime.getDataFlow("MyGraph").getStatementState());
tryInvalidCompile(epService, epl, "Error starting statement: Data flow by name 'MyGraph' has already been declared [");
tryInstantiate(epService, "MyGraph", "Data flow by name 'MyGraph' is currently in STOPPED statement state");
tryInstantiate(epService, "DUMMY", "Data flow by name 'DUMMY' has not been defined");
// destroy - should be gone
stmt.destroy(); // removed, create again
assertEquals(null, dfruntime.getDataFlow("MyGraph"));
assertEquals(0, dfruntime.getDataFlows().length);
tryInstantiate(epService, "MyGraph", "Data flow by name 'MyGraph' has not been defined");
try {
stmt.start();
fail();
} catch (IllegalStateException ex) {
assertEquals("Cannot start statement, statement is in destroyed state", ex.getMessage());
}
// new one, try start-stop-start
stmt = epService.getEPAdministrator().createEPL(epl);
stmt.stop();
stmt.start();
dfruntime.instantiate("MyGraph");
}
示例2: testCreateStartStop
import com.espertech.esper.client.dataflow.EPDataFlowDescriptor; //导入依赖的package包/类
public void testCreateStartStop() throws Exception {
String epl = "@Name('Create-A-Flow') create dataflow MyGraph Emitter -> outstream<?> {}";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
EPDataFlowRuntime dfruntime = epService.getEPRuntime().getDataFlowRuntime();
EPAssertionUtil.assertEqualsAnyOrder(new String[] {"MyGraph"}, dfruntime.getDataFlows());
EPDataFlowDescriptor desc = dfruntime.getDataFlow("MyGraph");
assertEquals("MyGraph", desc.getDataFlowName());
assertEquals(EPStatementState.STARTED, desc.getStatementState());
assertEquals("Create-A-Flow", desc.getStatementName());
dfruntime.instantiate("MyGraph");
// test duplicate
tryInvalidCompile(epl, "Error starting statement: Data flow by name 'MyGraph' has already been declared [");
// stop - can no longer instantiate but still exists
stmt.stop(); // not removed
assertEquals(EPStatementState.STOPPED, dfruntime.getDataFlow("MyGraph").getStatementState());
tryInvalidCompile(epl, "Error starting statement: Data flow by name 'MyGraph' has already been declared [");
tryInstantiate("MyGraph", "Data flow by name 'MyGraph' is currently in STOPPED statement state");
tryInstantiate("DUMMY", "Data flow by name 'DUMMY' has not been defined");
// destroy - should be gone
stmt.destroy(); // removed, create again
assertEquals(null, dfruntime.getDataFlow("MyGraph"));
assertEquals(0, dfruntime.getDataFlows().length);
tryInstantiate("MyGraph", "Data flow by name 'MyGraph' has not been defined");
try {
stmt.start();
fail();
}
catch (IllegalStateException ex) {
assertEquals("Cannot start statement, statement is in destroyed state", ex.getMessage());
}
// new one, try start-stop-start
stmt = epService.getEPAdministrator().createEPL(epl);
stmt.stop();
stmt.start();
dfruntime.instantiate("MyGraph");
}