Nov 10th, 2008, 09:00 AM
What is best practices for skipping the remaining job from a tasklet?
I'm considering strategies for a simple batch line, which starts with checking a drop directory. Only if a new file is found should the rest of the steps proceed and an item reader (file) resource need to be injected.
I'm considering either of these two alternatives:
Alt 1) Perform directory polling outside SpingBatch and launch a job only if a file is found.
Alt 2) Implement directory scan as a tasklet and cancel the job if no file is found.
The problem with alt 2 is that throwing an exception causes the job to fail and results in a restart. The SkipLimitStepFactoryBean class is item oriented and is not suited for a tasklet doing directory scanning.
Question 1) Has anybody experience of something similar and would like to share lessons learned?
Question 2) Besides of implementing directory scanning myself, are there any good libraries that work nicely with SpringBatch? I have found JPoller, but it seems abandoned and not present in any Maven repo (mvnrepository).
Tags for this Thread