xampo
xampo

Reputation: 399

Spring Cloud Dataflow - handling argument in Task

I would like to pass the ID of an object to a variable when starting a Task in Spring Cloud Dataflow. I know that it can be done with arguments or parameters, but I don't know how to handle these arguments or parameters in Java code so I can take over this value. Could you please indicate how this could be done?

Upvotes: 3

Views: 1580

Answers (1)

Ilayaperumal Gopinathan
Ilayaperumal Gopinathan

Reputation: 4179

In the context of Spring Cloud Data Flow, you can pass arguments or properties to your task application.

The arguments you pass for the Spring Cloud Task application are the command line arguments for the task application itself. You need to qualify the arguments as the command line arguments for your application.

The properties you pass for the Spring Cloud Task application are the application configuration properties or task deployer properties. They have to use the prefix app, deployer or scheduler.

For instance, for the out-of-the-box timestamp task application, you can see how arguments and properties can be used in the following example:

  • Register out-of-the-box task applications
  • Create timestamp task:
dataflow:>task create a1 --definition "timestamp"
  • Launch the task with arguments and properties
dataflow:>task launch a1 --arguments "--spring.main.banner-mode=off" --properties "app.timestamp.format=YYYY/DD/MM"

In the above case, the command line argument --spring.main.banner-mode=off is passed to the timestamp application while the timestamp application's property format is passed to the task application.

Upvotes: 1

Related Questions