May 2nd, 2008, 10:26 AM
Launching a job when a file system change
I have a use case. I want to start a spring batch job if a certain file appeared in a directory. Is that Spring Batch currently support such use case?
Also, an alternate use case is that we have a long runner daemon like job to monitor on a directory. Upon any new file come in, the job will process it and delete it. After that, the job still keeps running and continue to monitor the directory.
Is that Spring Batch can support this kind of usage?
May 2nd, 2008, 11:23 AM
In theory you could right a step that with directory polling if you like, but what you're really getting into is the realm of scheduling. Quartz, for example, has directory listeners that can kick off a Spring Batch job for the same net effect, and I think an approach like that is preferable to trying to code a step to do the same. It's not that it isn't possible, but rather there's better ways to do it.