- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Why use replaceNull when setting a value in Nifi updateAttribute
- Labels:
-
Apache NiFi
Created 03-29-2019 06:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
New to Nifi here. I was looking at this post. that talks about how to make a retry flow. In it there is a updateAttribute that sets the variable `retry.counter` to ${retrycounter:replaceNull('0'):plus(1)}. How come they set it to that instead of 1? This is the beginning of the flow and should always be 1, no? A similar thing is done with retry.maxcoutner - `${retry_maxcount:replaceNull('3')}`
Please help me understand the logic behind this.
Thanks!
Created 04-01-2019 04:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are numerous ways to accomplish the same result in NiFi.
The use of the ${retry.counter:replaceNull('0'):plus(1)} NiFi Expression language statement is to create an attribute with value 1 if attribute "retry.counter" does not exist on the FlowFile; otherwise, the existing value currently assigned to existing attribute "retry.counter" is returned and incremented by 1.
-
If we just set it to one, each time the same FlowFile passes through this loop it would get set to 1 and would never increment.
-
Thank you,
Matt
