I am using spring batch patitioning to run multiple threads of a job. The job is supposed to read from the database, process the data and write the results to either a file of database, below is my current configuration for my job.
<step id="masterStep">
<partition step="slave" partitioner="rangePartitioner">
<handler grid-size="10" task-executor="taskExecutor" />
</partition>
</step>
</job>
<!-- Jobs to run -->
<step id="slave" xmlns="http://www.springframework.org/schema/batch">
<tasklet>
<chunk reader="pagingItemReader" writer="flatFileItemWriter"
processor="itemProcessor" commit-interval="1" />
</tasklet>
</step>
With this configuration when the job is run, 10 threads of the job are started and that also means 10 readers are used, which means each record will be processed 10 times rendering the partitioning useless.
Can you please assist with a solution to partition only the processor and the reader so that we have multiple threads of the processor and the writer and use just 1 instance of the reader