We have created a Spring Batch job to be executed in Spring Cloud Data Flow through Spring Cloud Task (a simple task, it only executes the job). The execution has been checked both with the UI and the REST API, and everything is OK in an ideal case. The problem comes when we try to stop and restart a job. Following the REST API Guide:
- Launch the task: https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#api-guide-resources-task-executions-launching
- Get information of the task execution using the task execution id returned in the previous point: https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#api-guide-resources-task-executions-detail
- Here comes the first issue: if we stop the task with the task execution id (https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#api-guide-resources-task-executions-stopping) the job associated to the task stops its execution (in the logs) but in de database the job stays as "STARTED". And then it is impossible to restart the job execution as it never reachs the "STOPPED" status --> For the SCDF gurus... isn't that a bug or there is a technical reason?
- If we want to stop the job, it is necessary to get the jobExecutionIds first param from the response of the point 2, and make the request with the job execution id (https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#api-guide-resources-job-executions-stop)
- Waiting the appropiate time to complete the running step execution, the job reaches the "STOPPED" status. If now we restart the job (https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#api-guide-resources-job-executions-restart) a new task execution is created, linked with the new job execution, and it completes the processing.
And now the million dollar question: if we want to integrate SCDF with a planifier (like Control-M) how can we make polling requests to check the after-restart execution's status if the restart request does not return any execution id? If there is just a normal execution, we can send polling requests with the job execution id (step 4) associated to the task execution id (step 2), but after the restart we are "blind"