- 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 UpdateAttribute questions
- Labels:
-
Apache NiFi
Created ‎04-21-2016 10:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
How do you pull in a new attribute added by using UpdateAttribute, such as add a new attribute name as 'label' and value as 'source1', to flow file (say file saved to location by PutFile processor)?
Data Provenance showed new attribute with the right value in Attributes tab, but in Content tab Output Claim view does not show the new attribute at all. Shouldn't it shows there too?
Thanks!
Shannon
Created ‎04-21-2016 10:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Shannon,
You would call the new attribute with the expression language so you would type /root/${label}/ the {$VARIABLE} syntax can be used anywhere where expression language is allowed.
Created ‎04-21-2016 10:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Shannon,
You would call the new attribute with the expression language so you would type /root/${label}/ the {$VARIABLE} syntax can be used anywhere where expression language is allowed.
Created ‎04-21-2016 11:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Chris,
Thanks for the help! A follow up question-- what processor would it take to call the new attribute and add to the flowfile before sending to PutFile? It can't be MergeContent, right? couldn't find anything like union.
Thanks again!
Shannon
Created ‎04-21-2016 11:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
are you looking to replace the flowfile content with the extracted attribute? Perhaps AttributesToJSON
If you could mark my answer as correct if that solves the first one it closes out this question!
Created ‎04-21-2016 11:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Chris,
No - not replace, but add the new attribute to original attributes.
Thanks!
Shannon
Created ‎04-22-2016 03:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Architecturally each mmessage is immutable, changing anything in it means re-writing the flow-file contents. To add text to a message like that is tough. Is the message already in JSON format?
Created ‎04-22-2016 03:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, it is json format already.
update: parse all to attributes then turn them all back to Json together with new attribute solved it.
Thanks a lot for all your help!
Shannon
Created ‎04-22-2016 06:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shannon, try to extract the entire json into an attribute like you do. Then do "attributesToJson" to push it all inot one flow file perhaps?
