I came across one use case where user may send bulk records through UI for Postgres table update .
- Maximum possible record is 60,000
- Business logic will apply some logic on the data and insert/update 8 different tables
- There is already one Rest api which will handle one record as input and apply the same business logic and insert/update 8 different tables
What is best possible approach
Approach 1: create 1 rest api which will receive the data from UI from post method and format the input record and call the existing rest api for processing . For each record call that api in parallel
Approach 2: Create spring batch which will receive the data from UI( not sure how ) , write entire business logic in the process section( this is repeatable code of existing rest api ) . Use spring JPA to do the bulk insert/update using save all .
Please suggest what is the best option, or suggest is there any other better way . Sorry if this is too much information or too much I am asking .