0

We are developing the project by using spring batch partition.Our requirement is we will upload the file and validate the each record from file ,if all the records perfect then only will store in database.for that

We used Spring batch partitioning 1. ItemReader,CustomItemProcessor and CustomWriter.In ItemReader will read the data and CustomItemProcessor will validate the data finally CustomItemWriter will persist all the data in preparedStatement.Once all the process done finally will commit the data,how to do in one connection with more than one thread

Prince
  • 1
  • 5

1 Answers1

0

You should be reading the csv file! You can probably do it in two ways:

  1. Using parallel streams: Map each record into a object and with the Java8 parallel stream API you can achieve this
  2. NIO: Using Non blocking IO you can achieve this a way faster.

This post might be helpful : How to read all lines of a file in parallel in Java 8

Anupama Boorlagadda
  • 1,158
  • 1
  • 11
  • 19
  • I am using csv only in spring batch partition i am seperating into 5 partitions,so simulataneoulsy these 5 threads will read the data from csv and will set in prepared statement add batch.finally i will commit the connection.is it good way or any other way can i use? – Prince Jul 03 '17 at 13:34