Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get hold of the content?

Tags:

apache-nifi

I have spent several hours now trying to figure out the expression language to get hold of the flowfile content.

Have a simple test flow to try and learn Nifi where I have: GetMongo -> LogAttributes -> Put Slack

-----------------------LOG1-----------------------
Standard FlowFile Attributes
Key: 'entryDate'
        Value: 'Wed Sep 28 23:58:36 GMT 2016'
Key: 'lineageStartDate'
        Value: 'Wed Sep 28 23:58:36 GMT 2016'
Key: 'fileSize'
        Value: '70'
FlowFile Attribute Map Content
Key: 'filename'
        Value: '43546945658800'
Key: 'path'
        Value: './'
Key: 'uuid'
        Value: 'd1e10623-0e90-44af-a620-6bed9776ed62'
-----------------------LOG1-----------------------
{ "_id" : { "$oid" : "57ec27ec35a0759d54fb465d" }, "keyA" : "valueA" }

In the putSlack expression for test I have tried:

${flowfile.content}
${message}
${payload}
${msg}
${flowfile-content}
${content}
like image 264
Magnus_P Avatar asked Sep 29 '16 08:09

Magnus_P


1 Answers

There is no expression language that accesses the content of the flow file. The attributes and the content are purposely stored very differently in order to facilitate moving around a Flow File that could represent a large payload. Expression language operates on attributes only.

The ExtractText processor can be used to extract the whole content of the Flow File into an attribute, just keep in mind that should only be done when you know the content will have no problem fitting in memory.

like image 113
Bryan Bende Avatar answered Nov 10 '22 08:11

Bryan Bende