我已经在作业中定义了四个步骤,JobExecution 说已完成,但我想确保知道我的所有步骤都被调用并正确执行。
我们有什么方法可以调试每个步骤吗?
通过定义端点从 RestController 调用我的批处理作业
在配置文件下面找到。
@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();
}
}