我的测试管道非常简单。它尝试从通过控制台创建的主题中读取。
public static void main(String[] args) throws IOException {
Options options = PipelineOptionsFactory.fromArgs(args).
withValidation().as(Options.class);
options.setStreaming(true);
Pipeline pipeline = Pipeline.create(options);
PCollection<String> input = pipeline
.apply(PubsubIO.Read.topic(options.getPubsubTopic()))
.apply(ParDo.of(new ExtractEvents()));
pipeline.run();
}
当我尝试执行此管道时,出现以下错误:
工作流失败。原因:(de5f777e2e08c1d9):步骤 setup_resource_additionaltopic.subscription-375367840492394866711:设置资源 additionaltopic.subscription-3753678404923948667 失败
Dataflow 控制台还报告了一个内部错误:
我在文档中找不到任何内容,并且我尝试解决此问题的尝试和错误尝试都没有成功。
解决方案
要运行 Dataflow 作业,项目必须启用以下 Google Cloud Platform API:
- 谷歌云数据流 API
- 计算引擎 API(谷歌计算引擎)
- 谷歌云记录 API
- 谷歌云存储
- 谷歌云存储 JSON API
- BigQuery API
- 谷歌云发布/订阅
- 谷歌云数据存储 API
您可以使用 Google Cloud Platform Console一次性启用所有必需的 API。