1

I try to write example app using spring batch:

@Bean
public Step testStep() {
    return steps.get("testStep").<String,String>chunk(1)
            .reader(testReader())
            .processor(testProcessor())
            .writer(testWriter())
            .listener(testListener())
            .build();
}

When I throw exception in reader or processor or writer, the job stopped with status FAILED. How can I make job ignore exception and keep running.

I'm not use any xml config, just annotation and class. Please give me a hint or link.

Thanks for any support!

Edit: Can we add skip dynamically, like I post in answer below.

user1697646
  • 333
  • 2
  • 6
  • 15
  • 1
    Check http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/step/builder/FaultTolerantStepBuilder.html – Luca Basso Ricci Sep 20 '16 at 11:43
  • Possible duplicate of [Skippable exception classes for Spring Batch with java based configuration](http://stackoverflow.com/questions/24233821/skippable-exception-classes-for-spring-batch-with-java-based-configuration) – Luca Basso Ricci Sep 20 '16 at 11:44
  • I wrote an answer on how to configure the flow in case of an error: http://stackoverflow.com/questions/39134634/spring-batch-java-config-skip-step-when-exception-and-go-to-next-steps/39143725#39143725. This example shows, how you can configure the flow with the java api so that the next step is started if the previous step failed. – Hansjoerg Wingeier Sep 21 '16 at 05:40
  • thank you so much! – user1697646 Sep 21 '16 at 07:08

0 Answers0