- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
GenerateFlowFile Validations
- Labels:
-
Apache NiFi
Created 05-24-2023 11:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dears,
I am using GenerateFlowFile processor to pass month and year information.
The format in which we are passing custom text in GenerateFlowFile is as follows:
month|year
may|2023
Our requirement is, if user enters month and year information it has to be validated.
For example, he has to provide valid information like may,2023 but apart from this if he provides any other invalid information other than month and year attributes it has to through error.
How can we achieve such constraints or validation?
Thank you!
Created 05-26-2023 08:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@SowmyaP
There seems to be a lot of missing details needed from your use case description.
The GenerateFlowFile processor is used to create a FlowFile (it can be configured to produce a FlowFile with specific content and specific custom FlowFile Attributes as well).
So from your use case description, you are adding custom text to your GenerateFlowFile processor and want to validate that the custom added text is correct later in your dataflow? Biot confused on the validation since you are defining the format in the GenerateFlowFile. Where do you expect that text to get changed in your dataflow(s) thus requiring your to validate it?
I am not clear on yoru end-to-end use case.
Processors like the following can be used to validate FlowFiles:
1) RouteOnAttribute - could be used to evaluate a NiFi Expression Language (NEL) against the value of an attribute on a FlowFile and the route to a dynamic relationship. That dynamic failure relationship or unmatched relationship depending on your choice of implementation could be passed to an updateAttribute processor where you generate the log exception text. Then route to a logAttribute processor that could be configured to produce an ERROR log output line to the nifi-app.log reporting your exception.
2. RouteOnContent - Similar strategy as RouteOnAttribute except here you create dynamic properties that use java regular expressions that are evaluated against the FlowFIle's content instead of a FlowFile's attribute to route FlowFiles to a dynamic relationship. rest of dataflow design is same as above.
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
