- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to route on attribute name?
- Labels:
-
Apache NiFi
Created ‎11-03-2021 01:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, how can I route flowfiles based on attribute name, not its value? I know what the attribute names will be but not their values. For example, I want to route all flowfiles with the attribute AmazonUserAddDetection to one flow, whereas those with the attribute GCPUser to a different flow.
Created ‎11-04-2021 05:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Best way I can think of store that attribute name in another attribute. You can also use execute script processor and read the attribute name you are looking for as in :
var myAttr = flowFile.getAttribute('filename')
and if the value is not null then you can route the flow File to the desired relationship. For more information on how to use the execute script processor:
https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-1/ta-p/248922
