Problem: Read a file> 10 MB in size and upload it to the staging table using Spring Batch. How can we maintain state while reading a file to restart the task if it fails?
According to the documentation, FileItemReader is not thread safe, and if we try to make it thread safe, we will lose the restart. So, the main questions:
- Is there a way to read a file in blocks, and each thread knows which block to read?
- If we make the reading synchronous, what changes are needed to restart the job in this scenario?
If someone has encountered similar problems or has any analysis of how it works, we can make a decision.
Any pointers or example codes are also evaluated.
source
share