Delete the file after processing all lines in the file

I would like to delete the file after all the lines in the file have been processed. My streams look like

source (file --fixedDelay=0 --outputType=text/plain --dir=XXX) | 
    splitter --expression=payload.split('\\n') | 
    transform -> filter -> sink


My files are stored in a directory that is viewed by the file module. I would like every file to be deleted after it has been processed.



source to share

1 answer

It is really surprising that the source of the file does not have the ability to delete the file after processing, which can be confirmed by looking at the config file in xd / modules / source / file / config / file.xml (since version 1.1.0).

While file source does not have this parameter, sftp source does. Hence you can use the sftp source. This will require an ssh server on the machine where spring xd is installed. Does it help?

You can also add your own source module by customizing the file transformer. File transformers support the parameter delete-files="true"




All Articles