0

For testing purpose I am creating a URL that users can hit to manually kickoff a batch processing job on the backend. I then shoot back some debug data to the user so they can see it in their browser.

Right now I literally just pass a string variable from one function to next returning the result of each function all the way back down and out to the user. I feel like there has to be a better way to get the information I need from each of these functions and concatenate them.

This is all ran on a spring bean so I don't want to make the "debug" variable a property of the class.

Adam James
  • 3,833
  • 6
  • 28
  • 47

1 Answers1

1

You can extend JobExecutionListenerSupport and you get

public void afterJob(JobExecution jobExecution)
for (StepExecution stepExecution : jobExecution.getStepExecutions())

Look for methods available for jobExecution and stepExecution and you can print everything done by the job.

explorer
  • 486
  • 1
  • 6
  • 19
  • That would work, sadly this project does not have the org.springframework.batch package. – Adam James Mar 02 '15 at 00:42
  • There is a starter project which enables you to launch batch using REST calls over the top of Spring batch, refer the following : https://github.com/codecentric/spring-boot-starter-batch-web Other than that you can see Spring batch jobContext and stepContext functionality if you want to mimick the funationality yourself. Also look for how jobRepository is handeled in-memory or in DB and you get the idea. – explorer Mar 02 '15 at 03:15