Riyaz Khan
Riyaz Khan

Reputation: 135

How to filter file name in Nifi

I want to ingest data from email attachment to my HDFS path, for which i am using Nifi processor. There are multiples files are attached in attachment, i want a particular one. How to filter it in nifi?

Upvotes: 1

Views: 4600

Answers (1)

Sivaprasanna Sethuraman
Sivaprasanna Sethuraman

Reputation: 4132

If each of the attachment file is being as a separate FlowFile and you want to filter using filename then you could use RouteOnAttribute to filter the attachment files of interest and then connect it to PutHDFS.

For the above scenario, you can set the following property in RouteOnAttribute:

attachmentOfInterest : ${filename:equals("<interested_filename>")}

If you don't want to filter based on filename but based on something else, you can still follow this RouteOnAttribute approach but use different NiFi expression language instead of filename.equals. For a complete set of NiFi expression language, see this doc

Upvotes: 3

Related Questions