Sagitarius
Sagitarius

Reputation: 368

Using flowfiles default attributes inside code

I want to use filesize inside my groovy code so I've added updateAttribute inside with such expression ${filesize:toNumber()} and i want to use this attribute in my groovy code shown below:

def size=flowFile.getAttribute('filesize');
int value = size as Integer;
if(value.div(4)<=1)

but executescript processor gives me nosuchProperty exception; One more thing i want to know:will def flowFile=session.get(1) get the one fowfile at a time?

Upvotes: 0

Views: 600

Answers (1)

James
James

Reputation: 11931

Apache NiFi's built-in flowfile property for content length in bytes is fileSize (case-sensitive).

Upvotes: 2

Related Questions