Google cloud dataflow 如何运行我在Google数据流上编写Beam管道的.jar文件?

Google cloud dataflow 如何运行我在Google数据流上编写Beam管道的.jar文件?,google-cloud-dataflow,apache-beam,Google Cloud Dataflow,Apache Beam,我用ApacheBeam管道(用Java编写)编写了一个.jar文件,我想运行Google数据流。我把它装进桶里。当我进入数据流UI时,只有一个选项:从模板创建作业。但是我不能在那里使用我的.jar文件。如何将管道“导入”数据流?请按照以下步骤操作 mvn archetype:generate \ -DarchetypeGroupId=org.apache.beam \ -DarchetypeArtifactId=beam-sdks-java-maven-archetyp

我用ApacheBeam管道(用Java编写)编写了一个.jar文件,我想运行Google数据流。我把它装进桶里。当我进入数据流UI时,只有一个选项:从模板创建作业。但是我不能在那里使用我的.jar文件。如何将管道“导入”数据流?

请按照以下步骤操作

mvn archetype:generate \
      -DarchetypeGroupId=org.apache.beam \
      -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
      -DarchetypeVersion=2.16.0 \
      -DgroupId=org.example \
      -DartifactId=word-count-beam \
      -Dversion="0.1" \
      -Dpackage=org.apache.beam.examples \
      -DinteractiveMode=false
运行该命令后,您应该会在当前目录下看到一个名为word count beam的新目录。word count beam包含一个简单的pom.xml

要使用DataflowRunner运行作业,需要执行以下命令

mvn -Pdataflow-runner compile exec:java \
      -Dexec.mainClass=org.apache.beam.examples.WordCount \
      -Dexec.args="--project=<PROJECT_ID> \
      --stagingLocation=gs://<STORAGE_BUCKET>/staging/ \
      --output=gs://<STORAGE_BUCKET>/output \
      --runner=DataflowRunner"
mvn-Pdataflow runner compile exec:java\
-Dexec.mainClass=org.apache.beam.examples.WordCount\
-Dexec.args=“--项目=\
--stagingLocation=gs:///staging/\
--output=gs:///output\
--runner=数据流runner“

请参考此链接了解如何运行基于Java的云数据流-

Hi,这是单词计数示例。如何使用我自己的java文件实现这一点?将
-Dexec.mainClass=org.apache.beam.examples.WordCount
更改为您的主类。谢谢!我可以使用Eclipse完成第一步吗?是的,它是一个简单的maven构建。如果这个答案对你有帮助,请接受这个答案。为什么我们要运行mvn原型:生成这个命令?