在Google Dataflow模板中添加对JS UDF的支持

时间:2018-10-16 05:37:52

标签: java maven google-cloud-platform google-cloud-dataflow dataflow

我有this code的Google Cloud Platform数据流模板。

我希望为其添加更多功能,即希望添加对JavaScript UDF的支持。当我尝试编译文件时,使用以下命令:

mvn compile exec:java \
-Dexec.mainClass=com.google.cloud.teleport.templates.${PIPELINE_NAME} \
-Dexec.cleanupDaemonThreads=false \
-Dexec.args=" \
--project=${PROJECT_ID} \
--stagingLocation=gs://${PROJECT_ID}/dataflow/${PIPELINE_FOLDER}/staging \
--tempLocation=gs://${PROJECT_ID}/dataflow/${PIPELINE_FOLDER}/temp \
--runner=DataflowRunner \
--windowDuration=2m \
--numShards=1 \
--topic=projects/${PROJECT_ID}/topics/windowed-files \
--outputDirectory=gs://${PROJECT_ID}/temp/ \
--outputFilenamePrefix=windowed-file \
--outputFilenameSuffix=.txt"

编译文件时,出现以下错误:

An exception occured while executing the Java class. Class interface com.google.cloud.teleport.templates.PubsubToText$Options missing a property named 'topic'. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-cloud-teleport-java: An exception occured while executing the Java class. Class interface com.google.cloud.teleport.templates.PubsubToText$Options missing a property named 'topic'.

尽管如此,我已经通过--topic标志并插入了适当的值。

2 个答案:

答案 0 :(得分:2)

顶部的example是错误的。您必须通过--inputTopic而不是--topic。您可以在定义ValueProvider的{​​{3}}中看到这一点:

@Description("The Cloud Pub/Sub topic to read from.")
@Required
ValueProvider<String> getInputTopic();
void setInputTopic(ValueProvider<String> value);

您还可以从code UI运行模板,作业详细信息将显示该选项确实为inputTopic

Console

答案 1 :(得分:1)

javadoc中的调用示例现在应反映正确的输入参数(--inputTopic)https://www.terraform.io/docs/providers/azurerm/r/app_service.html