I have defined four steps in job ,JobExecution says completed, but i want to make sure to know all my steps are getting called and executed properly or not.
Do we have any way where i can debug each steps?
Calling my batch job from RestController by defining an endpoint
Find Below the configuration file.
@Configuration
@Log4j2
public class PickUpBatchConfig {
@Autowired
public JobBuilderFactory jobBuilderFactory;
@Autowired
public StepBuilderFactory stepBuilderFactory;
@Bean
public Job pickupJob() {
return this.jobBuilderFactory.get("pickupJob")
.listener(new JobResultListener())
.start(a())
.next(b())
.next(c())
.next(d())
.build();
}
@Bean
public Step a() {
System.out.println("PickUpBatchConfig.a");
return this.stepBuilderFactory.get("step1")
.Responsechunk(0)
.reader(new One())//dummy ,does nothing in step1
.processor(new Two())
.writer(new Three())
.build();
}
@Bean
public Step b() {
System.out.println("PickUpBatchConfig.b");
return this.stepBuilderFactory.get("step2")
.Responsechunk(0)
.reader(new Four())// Need to implement
.processor(new Five())
.writer(new Six())
.build();
}
@Bean
public Step c() {
System.out.println("PickUpBatchConfig.c");
return this.stepBuilderFactory.get("step3")
.Responsechunk(0)
.reader(new Seven())//need to implement
.processor(new Eight())
.writer(new nine())
.build();
}
@Bean
public Step d() {
System.out.println("PickUpBatchConfig.d");
return this.stepBuilderFactory.get("step4")
.Responsechunk(0)
.reader(new Ten())
.processor(new Elevan())
.writer(new Twelve())
.build();
}
}
JobExecution says completed
If you get access to the job execution and are able to inspect its status, then you could get all step executions using JobExecution#getStepExecutions
and inspect the status of each step.