Announcement Announcement Module
Collapse
No announcement yet.
Repeat steps based on information gathered in previous step Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Repeat steps based on information gathered in previous step

    Currently I have a job consisting of a single step that processes a single input file which is provided through the job's parameters (and in turn through a StepExecutionResourceProxy which is passed on to a FlatFileItemReader).

    This works fine. However I do not want to specify a single file when launching my job, I want to specify a directory containing multiple files and then my job should figure out which files to process. Therefore I'm considering to write a tasklet step that reads files from a directory (or an FTP site for that matter) and 'passes' these files to subsequent steps for processing.

    Implementing this tasklet shouldn't be a problem, but I'm wondering how to repeat the subsequent steps based on the number of files gathered during the tasklet step? For example, if there are four files eligable for processing in the directory, then the steps defined after the tasklet step should be executed four times. With the FlatFileItemReader receiving a new file/resource every step execution.

    Can I use the RepeatOperations for this purpose? should I use the RepeatOperationsStepFactoryBean (I'm currently happily using a SkipLimitStepfactoryBean)?

  • #2
    Some features to support this use case might come out of http://jira.springframework.org/browse/BATCH-428. I think maube what we need here is an ItemWriter that runs a step, based on an item which is a Resource for the input, rather than a Tasklet.

    Comment

    Working...
    X