3

I have a spring boot batch application that has 5 unique jobs that execute by console using the command:

java -jar artifactName jobName param1

but now this project will be move to cloud, so I need to use spring cloud task. So far so good.

I know that I have to define in the main class the @enableTask and also in the application.properties define the properties: spring.application.name=cloudTask

So reading the Spring documentation understand that for triggering my jobs using spring cloud dataflow server, can define a task that in this case i should use as cloudTask. But does not make sense because how will tigger it, because my application has 5 different jobs, so the question is:

how do i connect this task name with my jobs define in the application? The logic tell me that I need to define also 5 task name, then how do I bind this task name with the respective job.

1 Answers1

1
  1. With @EnableTask annotation, you should be able to register your batch as Task application in SCDF - Under 'Apps'
  2. Once your batch appears in Apps,
    If all jobs 5 jobs are independent, you should be able to create 5 different Composed Tasks with same App name but with different parameters,
    OR
    If those are interlinked, then linked jobs can be combined together in 1 composed task, by providing alias and passing corresponding set of parameters, in DSL.
  3. Once the composed task is launched, task execution status can be viewed under 'Task -> Executions' and corresponding to Jobs status can be viewed under 'Jobs'

To pass custom parameters to tasks, @EnableConfigurationProperties @ConfigurationProperties can be leveraged.

Guru
  • 964
  • 9
  • 12