title: Spring batch single threaded reader and multi threaded writer
body: <p>Tried to find if this was asked before but couldn't.</p>
  
  <p>Here is the problem. The following has to be achieved via Spring batch
  There is one file to be read and processed. The item reader is not thread safe.
  The plan is to have multithreaded homogenous processors and multithreaded homogenous writers injest items read by a single threaded reader.</p>
  
  <p>Kind of like below:</p>
  
  <pre><code>        ----------&gt; Processor #1 ----------&gt; Writer #1
         |
      Reader -------&gt; Processor #2 ----------&gt; Writer #2
         |
          ----------&gt; Processor #3 ----------&gt; Writer #3
  </code></pre>
  
  <p>Tried AsyncItemProcessor and AsyncItemWriter, but holding debug point on processor resulted in reader not being executed until the point was released i.e. single threaded processing.</p>
  
  <p>Task executor was tried like below:</p>
  
  <pre><code>&lt;tasklet task-executor="taskExecutor" throttle-limit="20"&gt;
  </code></pre>
  
  <p>Multiple threads on the reader were launched.</p>
  
  <p>Synchronising the reader also didn't work.</p>
  
  <p>I tried to read about partitioner but it seemed complex.</p>
  
  <p>Is there an annotation to mark the reader as single threaded? Would pushing read data to Global context be a good idea?</p>
  
  <p>Please guide towards a solution.</p>