This is what I need to do for testing purposes. I need a way to execute Spring's batch job whenever I want, based on certain given conditions (e.g. the number of items processed). However, until now I could not find anything like it.
I found that Spring Batch has something like this -
<step id="step1" parent="s1" next="step2"> <step id="step2" parent="s2"> <fail on="FAILED" exit-code="EARLY TERMINATION"/> <next on="*" to="step3"/> </step> <step id="step3" parent="s3">
But what I'm looking for looks like this -
public void myJobFailingMethod() { if(conditionsMatch()) {
How to do it?
Update. The task can also be performed outside the step.
source share