Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compare NiFi file content?

Tags:

apache-nifi

I'm new to NiFi. I was asked to fetch file from FTP server. If the file content is same as previous one, then do nothing, otherwise send the new file to another FTP server. Any ideas ?

Thanks,

Richard

like image 376
Richard W Avatar asked Jan 27 '23 23:01

Richard W


1 Answers

The HashContent processor and DetectDuplicate processor can be used for this.

HashContent will create a hash of the flow file content and put it in an attribute called hash.value.

DetectDuplicate will check a cache of hashed values to see if the same hash exists and then route it to the appropriate relationship (duplicate or non-duplicate).

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.8.0/org.apache.nifi.processors.standard.DetectDuplicate/index.html

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.8.0/org.apache.nifi.processors.standard.HashContent/index.html

like image 156
Bryan Bende Avatar answered May 02 '23 08:05

Bryan Bende