Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用数据流API启动时向模板传递参数_Java_Google App Engine_Google Cloud Platform_Google Cloud Dataflow_Apache Beam - Fatal编程技术网

Java 使用数据流API启动时向模板传递参数

Java 使用数据流API启动时向模板传递参数,java,google-app-engine,google-cloud-platform,google-cloud-dataflow,apache-beam,Java,Google App Engine,Google Cloud Platform,Google Cloud Dataflow,Apache Beam,我必须在启动时使用应用程序引擎数据流作业中的数据流API将参数传递给模板。 com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 = dataflowService.projects().locations().templates().launch(projectId,"us-central1",null); request1.

我必须在启动时使用应用程序引擎数据流作业中的数据流API将参数传递给模板。

 com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 = 


    dataflowService.projects().locations().templates().launch(projectId,"us-central1",null);

                request1.setGcsPath(template);
                request1.setLocation("us-central1");
                request1.setValidateOnly(false);

                //Storing launch Response
                LaunchTemplateResponse response1 = request1.execute();

在我的代码中,我可以设置GCS路径、位置和有效性,但不能像在Cloud函数中那样设置参数。这是使用java设置参数的任何方法。因为在Python中这是可能的,所以我认为在Java中也是如此。

要传递我使用的参数-: LaunchTemplateParameters=新的LaunchTemplateParameters()

LaunchTemplateParameters=new LaunchTemplateParameters();
Map Map=newhashmap();
put(“inputFile”,“gs://xyz bucket/Temp.txt”);
参数设置参数(map);
com.google.api.services.dataflow.dataflow.Projects.Locations.Templates.Launch request1=
dataflowService.projects().locations().templates().launch(projectId,“us-central1”,参数);
请求1.setGcsPath(模板);
请求1.设置位置(“us-central1”);
request1.setValidateOnly(false);
LaunchTemplateResponse response1=request1.execute();

您能详细解释一下“设置云中函数之类的参数”是什么意思吗?你应该能够为你的模板设置所有参数,就像gcs路径等。忽略上面的问题,我想我知道你在问什么。只是查了一下API。
LaunchTemplateParameters parameters = new LaunchTemplateParameters();
    Map<String,String> map = new HashMap<String,String>();
            map.put("inputFile", "gs://xyz-bucket/Temp.txt");
parameters.setParameters(map);
        com.google.api.services.dataflow.Dataflow.Projects.Locations.Templates.Launch request1 = 
                        dataflowService.projects().locations().templates().launch(projectId,"us-central1",parameters);

            request1.setGcsPath(template);
            request1.setLocation("us-central1");
            request1.setValidateOnly(false);


            LaunchTemplateResponse response1 = request1.execute();