- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
NIFI - Validate vame of file
- Labels:
-
Apache NiFi
Created ‎09-25-2018 08:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, is possible validate the name of the file to tingest in HDFS? I mean, i need validate the name of the file is correct and the size is > 0, it's possible?
Thanks.
Created ‎09-25-2018 10:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes we can validate the name of the file and size of file before ingesting into HDFS by using RouteOnAttribute processor.
in NiFi we are having attributes to the flowfile as
1.${filename} //gets the filename of the flowfile 2.${fileSize} //gets the size in bytes of the flowfile
In RouteOnAttribute processor add new property as
valid_files
${filename:equlas("<required_file_name>"):and(${fileSize:gt(0)})}
In the above expression we are using NiFi expression language and checking the filename value equlas(expression language function) to <required_file_name> and checking fileSize value is greater than 0, Then only the flowfiles will be tranferred into valid_files relation.
Feed only the valid_files relation to PutHDFS processor, By using this relation we are storing only the files that satisfies the condition will be stored into HDFS.
-
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.
Created ‎09-25-2018 10:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes we can validate the name of the file and size of file before ingesting into HDFS by using RouteOnAttribute processor.
in NiFi we are having attributes to the flowfile as
1.${filename} //gets the filename of the flowfile 2.${fileSize} //gets the size in bytes of the flowfile
In RouteOnAttribute processor add new property as
valid_files
${filename:equlas("<required_file_name>"):and(${fileSize:gt(0)})}
In the above expression we are using NiFi expression language and checking the filename value equlas(expression language function) to <required_file_name> and checking fileSize value is greater than 0, Then only the flowfiles will be tranferred into valid_files relation.
Feed only the valid_files relation to PutHDFS processor, By using this relation we are storing only the files that satisfies the condition will be stored into HDFS.
-
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.
