Support Questions
Find answers, ask questions, and share your expertise

How to route on attribute name?

Explorer

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.

 

vatodorov19_0-1635971441519.png

 

1 REPLY 1

Expert Contributor

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

; ;