Java 使用PubsubIO源运行googledataflow进行测试
我正在使用Google Cloud创建数据处理应用程序Java 使用PubsubIO源运行googledataflow进行测试,java,Java,我正在使用Google Cloud创建数据处理应用程序Dataflow——它将数据从Pubsub流到Bigquery 我对基础设施有些困惑。我创建了我的应用程序原型,可以在本地运行,使用源和目标文件(带有TextIO) 但是,如果我将source更改为PubsubIO.Read.subscription(…)我会失败,出现“java.lang.IllegalStateException:没有注册用于PubsubIO.Read的计算器”(我并不感到惊讶,因为我看不到任何通过身份验证的方法) 但我该
Dataflow
——它将数据从Pubsub
流到Bigquery
我对基础设施有些困惑。我创建了我的应用程序原型,可以在本地运行,使用源和目标文件(带有TextIO
)
但是,如果我将source更改为PubsubIO.Read.subscription(…)
我会失败,出现“java.lang.IllegalStateException:没有注册用于PubsubIO.Read的计算器”(我并不感到惊讶,因为我看不到任何通过身份验证的方法)
但我该怎么办呢?我应该在googlecloudengine
中创建一些虚拟机并在那里部署一些东西,还是应该以某种方式描述一个作业
,并将其提交给数据流API
(而不考虑任何显式的VM-s?)
你能给我指一些关于这个主题的分步指导吗?或者简单地解释一下工作流程。很抱歉,这个问题可能很愚蠢。您需要在谷歌云基础设施上运行管道才能访问PubSub,请参阅: 从他们的页面:
// Create and set your PipelineOptions.
DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
// For Cloud execution, set the Cloud Platform project, staging location,
// and specify DataflowPipelineRunner or BlockingDataflowPipelineRunner.
options.setProject("my-project-id");
options.setStagingLocation("gs://my-bucket/binaries");
options.setRunner(DataflowPipelineRunner.class);
// Create the Pipeline with the specified options.
Pipeline p = Pipeline.create(options);
// Specify all the pipeline reads, transforms, and writes.
...
// Run the pipeline.
p.run();