从云数据流上的流中调用任务时未传递参数

时间:2019-01-25 12:49:16

标签: spring-boot spring-cloud-dataflow

我试图从流中启动我的componse任务,但是我无法将信息传递给任务本身。

到目前为止,这是我在流应用中的代码

      Map<String, String> environmentProperties = new HashMap<>();
      environmentProperties.put("graph", "my-composed-task");


      List<String> commandLineParameter = new ArrayList<>();
      commandLineParameter.add("--increment-instance-enabled=true");

      Map<String, String> deploymentProperties = new HashMap<>();

      TaskLaunchRequest taskLaunchRequest = new TaskLaunchRequest(
                    springCloudHttpSourceProperties.getUri(),
                    commandLineParameter,
                    environmentProperties,
                    deploymentProperties,
                    springCloudHttpSourceProperties.getTaskName()
       );

       log.info("" + taskLaunchRequest);

       this.sink.input().send(new GenericMessage<>(taskLaunchRequest));

graph属性似乎运行良好,但是--increment-instance-enabled命令行似乎没有通过。

在我的服务器日志上,我可以看到没有命令行参数的情况下进行的呼叫:

Co.s.c.d.spi.local.LocalTaskLauncher: Command to be executed: /opt/openjdk/bin/java -jar /root/.m2/repository/org/springframework/cloud/task/app/composedtaskrunner-task/2.0.2.RELEASE/composedtaskrunner-task-2.0.2.RELEASE.jar --spring.cloud.task.executionid=1

但是例如,如果我使用外壳或使用UI本身来完成此任务 使用命令:

task launch my-composed-task --arguments "--increment-instance-enabled=true"

一切似乎都传承了:

Co.s.c.d.spi.local.LocalTaskLauncher: Command to be executed: /opt/openjdk/bin/java -jar /root/.m2/repository/org/springframework/cloud/task/app/composedtaskrunner-task/2.0.2.RELEASE/composedtaskrunner-task-2.0.2.RELEASE.jar --increment-instance-enabled=true --spring.cloud.task.executionid=1

我正在使用组成任务运行器jar的2.0.2.RELEASE。

我是在做错什么还是我不知道的cloudflow中的错误?

0 个答案:

没有答案