1

Let's imagine the following situation: I have a user which using the admin panel, uploads a csv file and transforms that csv in a new one with additional data retrieved from the DB. This csv must be stored somewhere in our server and we want to perform this transformation asynchronously.

I know about Spring batch so I've tried how to figure out if there is any posibility to set the file of the batch process dynamically. I've made some tests and I've achieved to launch an spring batch job but using a hardcoded file setted in the bean constructor.

We are using grails and the spring-batch plugin. The thing is... Is there any other better way to process a huge CSV asynchronously without memory errors? I was revieweing this post Spring batch to upload a CSV file and insert into database accordingly but I don't know if it is the best approach.

mannuk
  • 1,259
  • 5
  • 21
  • 43
  • 2
    Use a parameter with `JobParameters` or don't use SB at all and process CSV line-by-line by yourself – Luca Basso Ricci Apr 19 '18 at 14:25
  • How can I use an uploaded file path parameter in JobParameters? Will the job launch the task asynchronously? I mean... If the controller uploads the file and then calls to the job launcher. – mannuk Apr 20 '18 at 09:16
  • Who knows the real path of uploaded file should be responsible to start the job – Luca Basso Ricci Apr 20 '18 at 09:18
  • What is the way to process this batch asynchronously? To respond users through the controller that everything is going to be processed but do it in background. – mannuk Apr 23 '18 at 15:34

0 Answers0