Created 03-07-2017 04:13 PM
Hello,
My use case is to create a set of empty files with .sem at the end of each new file, downloaded in every batch run.
Created 03-07-2017 04:19 PM
You can use GenerateFlowFile to create 0-Byte flow files. Recent versions of NiFi also let you supply dynamic properties to GenerateFlowFile which means you can add a "filename" attribute set to "${filename}.sem", the filename part will be a timestamp/number. If your version of NiFi doesn't support dynamic properties in GenerateFlowFile, you can use UpdateAttribute afterward to do the same.
Note that GenerateFlowFile runs continuously on the schedule you pick, so there isn't a concept of being "done" or creating a "batch". Instead you could manually (or via the REST API) stop the processor when you have the requisite number of flow files created.
To write the files somewhere, use the PutFile processor.
Created 03-07-2017 04:26 PM
Matt,
Thanks a lot for such a speedy response.
I just tried, i see all the options, but it doesnt let me put a connector between PutSFTP and GenerateFlowFile.
On the canvas, i have GetSFTP connected to PutSFTP and then GenerateFlowFile, I want to trigger GenerateFlowFile once PutSFTP copies over the files.
Am i doing anything wrong?
Created on 03-07-2017 05:45 PM - edited 08-19-2019 01:04 AM
You current flow is as follows?
getSFTP ---->(success)----> putSFTP ---->(success)----> ??? After you put copies of your FlowFiles content to your target SFTP server using putSFTP, do you have any need for the content any longer?
If not you could simply use the ReplaceText processor configured as follows:
"Always replace" will replace the entire content with the configured "replacement value". If blank you will end up with a 0 byte file for every FlowFile that was successfully written to your putSFTP server.
Is this what you are looking for?
Thanks, Matt
Created 03-07-2017 06:46 PM
My requirement is getSFTP ---->(success)----> putSFTP ---->(success)---->write $filename.sem to a seperate directory on the same remote server where i applied putSFTP, these .sem files are trigger for my ETL application.
And yes i need to keep the data i brought in with putSFTP.
thanks.
Created on 03-07-2017 08:00 PM - edited 08-19-2019 01:04 AM
You need to keep the NIFi copy of the data even after writing a copy of it out via the putSFTP?
If you need to retain a local copy of the data, route success twice form your putSFTP processor.
So you should be able to do this with.....
The UpdateAttribute processor can be used to update the filename by adding the following new property to its configuration:
The Local copy of your Files remain unchanged down the success relationship to the left. The copy sent down the path to the right will have its content cleared, filename changed, and then sent via another PutSFTP.
Thanks,
Matt