1

I am having a web based spring batch application. My Batch Job will be kick started on an API call. Here is my method exposed as a web service.

    @RequestMapping(value = "/v1/initiateEntityCreation", method = RequestMethod.GET)
    public String initiateEntityCreation()
            throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException,
            JobParametersInvalidException, NoSuchJobException, JobInstanceAlreadyExistsException {
        JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
        jobParametersBuilder.addDate("Date", new Date());
Long executionContext = jobOperator.start("InitiateEntityCreation", String.format("Date=%s", new Date()));
        return executionContext.toString();
    }

My batch job is working fine and i have a Mysql Instance as my Job Repository. I have integrated Spring Cloud data flow to my batch application. I have my @EnableTask annotation and all necessary dependencies. I have connected my Spring Cloud data local server to my spring batch jon Repository instance.

Here is what my command line argument for SCDF.

java -jar spring-cloud-dataflow-server-local-1.2.3.RELEASE.jar --
spring.datasource.url=jdbc:mysql://localhost:3306/springbatchdb--
spring.datasource.username=root --spring.datasource.password=password --
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver  

My Local server is running and capturing all the job execution instances. I have registered my spring batch application to SCDF and defined a task for SCDF with the definition.

When am trying to launch the job from SCDF, am getting "Task successfully executed". But my job is not getting executed.

If I check task executions, am seeing like

StartTime N/A, EndTime N/A and if I drill down to task execution there are not batch jobs that have been run. Please let me know how we can launch a web based spring batch job using Spring Cloud data flow.

  • For questions like this, it'd be great if we have more background to review - see [here](https://github.com/spring-cloud/spring-cloud-dataflow#reporting-issues). Please clarify whether your batch-job as a task can run standalone successfully. Also, it'd be good to review your task definition as well. – Sabby Anandan Feb 09 '18 at 16:11
  • I am using spring-cloud-dataflow-server-1.2.3.RELEASE and spring-cloud-dataflow-shell-1.2.3.RELEASE. And i registered my application by the command , app register appname --type task --uri filepath and created task as, task create taskname --definition appname. – Jagadheeswaran Mohan Feb 10 '18 at 20:17
  • And can we launch a Long Run Process via SCDF? – Jagadheeswaran Mohan Feb 10 '18 at 20:20
  • A long-running process is commonly referred to as a "stream". It is continuous and always running; hence the name. If you're referring to a batch-job that runs for a long time, but it _still completes_ after processing, yes, you can orchestrate that in SCDF, too. Looks like you're already engaged in the Gitter channel, you can continue the conversation there. – Sabby Anandan Feb 11 '18 at 00:29

0 Answers0