简体   繁体   中英

Our spring batch job is having only one step. We have reader, processor,writer Operations in the step. How to stop proceeding to processor step

Our spring batch job is having only one step.we have reader, processor, writer Operations in the step. How to stop proceeding to processor step when prior step is failing?

You reader is implementing something like this:

public class MyReader implements Tasklet, StepExecutionListener {

In that case you can use the ExitStatus to signal the error. For example:

  @Override
  public ExitStatus afterStep(StepExecution stepExecution) {


    return ExitStatus.FAILED;
  }

In this case batch processing will stop and no more processing occur.

afterStep is available from StepExecutionListener .

Reference: https://docs.spring.io/spring-batch/docs/current/api/org/springframework/batch/core/ExitStatus.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM