title: How does Spring Batch manage transactions (with possibly multiple datasources)?
body: <p>I would like some information about the data flow in a Spring Batch processing but fail to find what I am looking for on the Internet (despite <a href="https://stackoverflow.com/questions/29303155/how-does-spring-batch-transaction-management-work">some useful questions</a> on this site).</p>
  
  <p>I am trying to establish standards to use Spring Batch in our company and we are wondering how Spring Batch behaves when several processors in a step updates data on different data sources.</p>
  
  <p>This question focuses on a chunked process but feel free to provide information on other modes.</p>
  
  <p>From what I have seen (please correct me if I am wrong), when a line is read, it follows the whole flow (reader, processors, writer) before the next is read (as opposed to a silo-processing where reader would process all lines, send them to the processor, and so on).</p>
  
  <p>In my case, several processors read data (in different databases) and updates them in the process, and finally the writer inserts data into yet another DB. For now, the JobRepository is not linked to a database, but that would be an independent one, making the thing still a bit more complex.</p>
  
  <p><strong>This model cannot be changed</strong> since the data belongs to several business areas.</p>
  
  <p><strong>How is the transaction managed in this case?</strong> Is the data committed only once the full chunk is processed? And then, is there a 2-phase commit management? How is it ensured? What development or configuration should be made in order to ensure the consistency of data?</p>
  
  <p>More generally, <strong>what would your recommendations be in a similar case?</strong></p>