Reputation: 1156
I am working on spring batch job. Flow is like below
step 1: (read,process,write on File1)
step 2: mail entries
step 3: (read,process,write on File2)
step 4: mail entries for File2.
I want to skip mailing step if no items are written.
I came across decision control like
<batch:decision id="decision" decider="com/Decider">
<batch:next on="FAILED" to="step_3"/>
<batch:next on="COMPLETED" to="step_2"/>
</batch:decision>
But how to get write count from previous step to this decision class?
Upvotes: 1
Views: 379
Reputation: 18403
JobExecutionDecider#decide
has a StepExecution
parameter where you can find how many items were written during last step execution (StepExecution#getWriteCount
)
Upvotes: 2