I need to get JobId in the itemwriter, it is multithreaded web app
Using this code returns wrong job id, since beforestep method is called for each job run and so it only returns the latest run jobID.public void beforeStep(StepExecution stepExecution) {
this.stepExecution = stepExecution;
}
public void write(List<? extends T> items) throws Exception {
ExecutionContext stepContext = stepExecution.getExecutionContext();
long jobId = stepExecution.getJobExecution().getJobId();
}
Is there a any other way to get jobId in item writer.


Reply With Quote
