-2

I am searching for approach/ code base which can fulfill the below requirement.

  1. We have source file(formatted) in shared drive which has ~one million record count, this drive has new file every day with date prefix on it(eg: 02-12-2018_abcd.txt)

    2.While reading file from sharedrive location, if its any failure occuer it
    should not commit the sql insert.

    3.this job should run on schduled time.

I found the couple of approaches to read file from shared drive like jar to read, another approach is to copy the file from shared drive to local machine(on applicaion server) and do spring batch processing and other approach is using spring integration adapter, inbount channel etc.

Please suggest and the best approach and spring code base/ git code for the same. Thanks

Rubia
  • 445
  • 2
  • 6
  • 17

1 Answers1

1

This is a typical use case where Spring Batch can help. You can have a first step (of type tasklet) that copies the file from the shared drive to the local machine and then a second step (of type chunk oriented tasklet) that reads the file and inserts data in the database.

You can find samples here: https://github.com/spring-projects/spring-batch/tree/master/spring-batch-samples

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50