4
votes

My current project is based on Spring Batch and Spring integration.

My goal is using Spring Batch to execute job flow steps:

  1. read file from SFTP server(step1).
  2. decrypt the file(step2).
  3. save the file into database(step3).

I want to divide this into steps queue(read from sftp, decrypt, write to db). And I also need to save the file, transfer start time, transfer end time, file size into DB.

Some days ago, I used Spring integration to poll file from sftp server and then send it to Spring batch to do the extra job. Also I can not get the transfer start time.

But now my project is main based on Spring batch, not Spring Integration.

Can you give me some suggestions ?

Or, can you show me how to use Spring Batch to drive Spring Integration for reading SFTP files.

And how can I get the transfer start time ?

Thanks. :)

1
Welcome. This looks like three different questions to me. It's going to be pretty hard for someone to answer all of them concisely. How about you start off with one specific question and see where that gets you? - Mark Chorley
@Mark Chorley I will adopt your advice in my next ask. :) - cyberzlex

1 Answers

4
votes

Add a tasklet as the first step; have the tasklet invoke a Spring Integration flow, probably using an sftp outbound gateway to GET the file.

There's an example of how to use the gateway in the sftp sample.

The 'transfer start time' would be the time you invoke the gateway.