【问题标题】:Launching task in Spring Cloud Dataflow with application properties使用应用程序属性在 Spring Cloud Dataflow 中启动任务
【发布时间】:2019-05-13 02:04:00
【问题描述】:

我在 SCDF 中有一个 Spring Cloud 任务,它使用任务定义成功启动:

some-task --some.property=test

不过,我想在任务启动时设置some.property 属性。我想我可以通过设置部署属性 app.*.some.property=test 来做到这一点,但这不适用于本地或 cloudfoundry 任务启动器/部署器。

上述部署属性适用于流,但不适用于任务。是否应该与任务一起工作,如果不是,为什么?

【问题讨论】:

  • 它也应该在任务上。不过,我们在最近的版本中增加了对它的支持。您能否确认 SCT、SCDF 和自定义应用程序的版本?
  • @SabbyAnandan 我们目前使用的是 SCT 2.0.0.RELEASE 和 SCDF 1.7.0.RELEASE,任务应用基于 Spring Boot 2.0.4。挖掘 cloudfoundry 部署程序,我认为这是the method handling it。但它根本不引用app.* 属性,所以我不确定在哪里寻找该功能。如果有帮助,我会尝试整理一些 POC 来重现该问题
  • 谢谢。你几乎是最新的,我很确定改进已经在那个版本中了。与解析器、属性和编排有关的核心改进通常在 SCDF 本身中处理。请参阅docs-1docs-2 了解一些示例。
  • 如果您继续看到这种行为,是的,最好查看可重现的样本。

标签: spring-cloud spring-cloud-dataflow


【解决方案1】:

是的。我们可以在启动任务时传递属性。

任务应用程序需要相同的数据库连接,Dataflow 服务器用于记录步骤和执行。我在本地 SCDF 中部署了以下任务。

task create --definition "timestmp_custm  --timestamp.format=\"dd.MM.yyyy\"" --name  taskTimestmp2

task launch taskTimestmp2 --arguments "--spring.datasource.url=jdbc:mysql://localhost:3306/mydb  --spring.datasource.username=root --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-31
    • 2018-01-27
    • 2018-07-10
    • 1970-01-01
    • 2021-10-11
    • 1970-01-01
    • 2018-09-09
    • 1970-01-01
    相关资源
    最近更新 更多