'Using flowfile size as an argument in RouteOnAttribute nifi

I want to know if is it possible to use flowfile size as an argument in routeOnAttribute i want to make expression like that :

${filename.fileSize>500}

but it tells me that expression ought to return true and my expression returns string what should i do to be able to make new connection in routeOnAttribute(p.s filename is my flowfile name)

EDIT 05/17/2019 Correct answer is Andy's. That is the best guidance from us (Apache NiFi team) on the subject. The answer marked "correct" only applies in a few cases where Content-Length is set by an upstream processor. Andy's solution, fileSize is universally applicable.



Solution 1:[1]

Your expression is logically correct but does not use valid Apache NiFi syntax. It should use the gt function as below:

${fileSize:gt(500)}

This will return a boolean result.

Solution 2:[2]

On the RouteOnAttribute, you can configure an attribute whose value evaluates to true when flowfile content is of certain size.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Vijay Kumar