В SpringBatch задание не завершается с заданными шагами, вместо этого продолжается переход от Writer к Reader, в то время как количество обнаруженных отладочных контекстов увеличивается как 1
из-за того, что статус выполнения становится «CONTINUABLE»не "ЗАВЕРШЕНО".
Шаг 1 завершается, но у шага 2 возникла эта проблема .., пожалуйста, помогите ..
@Configuration
@Log4j2
public class PickUpBatchConfig {
@Autowired
public JobBuilderFactory jobBuilderFactory;
@Autowired
public StepBuilderFactory stepBuilderFactory;
private StepExecution stepExecution;
@Bean
public Job pickupJob() {
return this.jobBuilderFactory.get("pickupJob")
.incrementer(new RunIdIncrementer())
.listener(new JobResultListener())
.start(readAndFilterBlockInventoryExtract())
.next(blockKeyFetch())
.next(processRequest())
// .next(sendMessage())
.build();
}
@Bean
public StepResultListener customStepListener() {
return new StepResultListener();
}
@Bean
public Step readAndFilterBlockInventoryExtract() {
System.out.println("*****PickUpBatchConfig.readAndFilterBlockInventoryExtract********");
return this.stepBuilderFactory.get("step1")
.<BlockInventoryExtractProcessRequest<ProcessRequest>, BlockInventoryExtractProcessor.BlockInventoryExtractBuilder>chunk(0)
.reader(new BlockInventoryReader())
.processor(processor())
.writer(new BlockInventoryWriter())
.listener(promotionListener())
.build();
}
@Bean
public ExecutionContextPromotionListener promotionListener() {
ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener();
listener.setKeys(new String[] {"builder"});
listener.setStrict(true);
return listener;
}
@Bean
public ItemProcessor<BlockInventoryExtractProcessRequest<ProcessRequest>, BlockInventoryExtractProcessor.BlockInventoryExtractBuilder> processor() {
return new BatchBlockInventoryExtractProcessor();
}
@Bean
public Step blockKeyFetch() {
System.out.println("PickUpBatchConfig.blockKeyFetch");
return this.stepBuilderFactory.get("step2")
.<BlockInventoryExtractProcessor.BlockInventoryExtractBuilder,BlockInventoryExtractProcessor.BlockInventoryExtractBuilder>chunk(1)
.reader(new BlockKeyReader())// Need to implement
.processor(step2processor())
.writer(new BlockKeyWriter())
.listener(promotionListenerStep2())
.build();
}
@Bean
public ExecutionContextPromotionListener promotionListenerStep2() {
ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener();
listener.setKeys(new String[] {"blockKey"});
listener.setStrict(true);
return listener;
}
@Bean
public ItemProcessor<BlockInventoryExtractProcessor.BlockInventoryExtractBuilder,BlockInventoryExtractProcessor.BlockInventoryExtractBuilder> step2processor() {
return new BlockKeyProcess();
}
@Bean
public Step processRequest() {
System.out.println("PickUpBatchConfig.processRequest");
return this.stepBuilderFactory.get("step3")
.<BlockInventoryExtractProcessor.BlockInventoryExtractBuilder, List<BlockInventoryExtractProcessRequest>>chunk(0)
.reader(new ProcessRequestReader())//need to implement
.processor(new ProcessRequestProcessor())
.writer(new ProcessRequestWriter())
.listener(promotionListenerStep3())
.build();
}
@Bean
public ExecutionContextPromotionListener promotionListenerStep3() {
ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener();
listener.setKeys(new String[] {"processRequest"});
listener.setStrict(true);
return listener;
}