Java Reference
In-Depth Information
trans.setTimestamp(rs.getDate("timestamp"));
return trans;
}
}
);
}
}
Now, execute the job twice. The first time, execute the job with a transaction.csv that has an
invalid integrity record. In other words, you run the job with an input file of 100 records plus an integrity
record at the end. The integrity record is any number other than 100; here you use the number 20. When
the job executes, the StepListener validates that the number of records you read in (100) doesn't match
the number expected (20) and returns the value ExitStatus.STOPPED , stopping the job. You can see the
results of the first run via Spring Batch Admin in Figure 6-7.
Figure 6-7. Results of the first run of transactionJob
When the job stops, delete the contents of the Transaction table and update your transaction file to
have 100 records and an integrity record say 100 as well. This time, when you execute the job, as Figure
6-8 shows, it runs to completion successfully.
 
Search WWH ::




Custom Search