Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi GetHTTP processor's uuid attribute

avatar

I'm using nifi-1.1.0.0-10 and trying to save the output of a URL to a unique filename using GetHTTP processor. There is a 'Filename' property that supports expression language, but ${uuid} does not seem to work like other variables.

./downloads/${uuid} evaluates to ./downloads/

while

./downloads/${UUID()} evaluates to ./downloads/40b08a2c-de4f-4504-ac86-1743b59a3810/

is ${uuid} a special attribute that cannot be used in 'FIlename' inside of GetHTTP processor?

1 ACCEPTED SOLUTION

avatar

Andrew is correct in regards to the difference between ${uuid} and ${UUID()} but the reason why ${uuid} doesn't work is because the GetHTTP processor doesn't evaluate the expression language in relation to the new flowfile.

As you can see on this line: https://github.com/apache/nifi/blob/528dab78d6dbc3bb4f61663f423b07284936ec40/nifi-nar-bundles/nifi-s...

It calls "evaluateAttributeExpressions()" with no parameters so the "uuid" of the new flowfile is outside the scope of the expression language when being evaluated. If you want to re-use the UUID for the FlowFile you can use an UpdateAttribute processor to append the UUID to "./downloads/".

View solution in original post

2 REPLIES 2

avatar

Vlad, I think there's a misunderstanding here. See if I understood the problem below.

In the GetHTTP the Filename is something you assign. You can use an expression, but that also means that you must invoke the UUID() function to generate the id. It doesn't exist yet.

The ${uuid} syntax reads an existing UUID. It will work down the line in your data flow, but it will not generate any id for you.

In your case, it is correct to use the UUID() function.

avatar

Andrew is correct in regards to the difference between ${uuid} and ${UUID()} but the reason why ${uuid} doesn't work is because the GetHTTP processor doesn't evaluate the expression language in relation to the new flowfile.

As you can see on this line: https://github.com/apache/nifi/blob/528dab78d6dbc3bb4f61663f423b07284936ec40/nifi-nar-bundles/nifi-s...

It calls "evaluateAttributeExpressions()" with no parameters so the "uuid" of the new flowfile is outside the scope of the expression language when being evaluated. If you want to re-use the UUID for the FlowFile you can use an UpdateAttribute processor to append the UUID to "./downloads/".