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


Java EPDataFlowDescriptor类代码示例

本文整理汇总了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");
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:42,代码来源:ExecDataflowAPICreateStartStopDestroy.java

示例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");

}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:44,代码来源:TestAPICreateStartStopDestroy.java


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