We are developing a spring batch application which is going to process "big" files in the future. To maintain a low memory signature we use spring batch on the smallest possible chunks of these files.
After processing, we want to write a result back to SFTP
, which also happens per chunk of the input file.
The current approach is as follows:
StepExecutionListener.before()
: we send a message to the SftpOutboundAdapter
with FileExistsMode.REPLACE
and empty payload to create an empty file (with .writing
)
Reader
: will read the input file
Processor
: will enhance the input with the results and return a list of string
Writer
: will send the list of strings to another SftpOutboundAdapter
with FileExistsMode.APPEND
StepExecutionListener.after()
: In case the execution as successful we will rename the file to remove the .writing
suffix.
Now I saw that there are Streaming Inbound Adapters
but I could not find Streaming Outbound Adapters
.
Is this really the only/best way to solve it by append? Or is it possible to stream the file content?