首页 > 解决方案 > 检测到“execution.runtime-mode”设置为“BATCH”的 UNBOUNDED 源

问题描述

我有以下简单的测试用例。

  test("batch query test 4") {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    env.setParallelism(1)
   
    env.setRuntimeMode(RuntimeExecutionMode.BATCH)

    //Detected an UNBOUNDED source with the 'execution.runtime-mode' set to 'BATCH'.
    // This combination is not allowed, please set the 'execution.runtime-mode' to STREAMING or AUTOMATIC
    val ds = env.addSource(new StockSource(emitInterval = 1500))
    ds.print()
    env.execute()
  }

StockSource是一个简单的实现SourceFunction,当我运行上面的应用程序时,抛出一个异常,异常消息如下,我会问

  1. 这是否意味着所有的实现都SourceFunction将被视为无界?
  2. 就我而言,我怎样才能使该addSource方法起作用,我的代码中是否遗漏了一些东西。

标签: apache-flink

解决方案


推荐阅读