Sorry, I should have been more clear.  I have a flow file with conten.  To that 
flow file, I need to add the content of a disk file as an attribute without 
losing the original content.

Does that better explain things?

Chris McDermott

Remote Business Analytics
STaTS/StoreFront Remote
HPE Storage
Hewlett Packard Enterprise
Mobile: +1 978-697-5315

[cid:image001.png@01D1FEB1.02CE0E20]

From: Matt Burgess <mattyb...@gmail.com>
Reply-To: "users@nifi.apache.org" <users@nifi.apache.org>
Date: Wednesday, August 24, 2016 at 5:13 PM
To: "users@nifi.apache.org" <users@nifi.apache.org>
Subject: Re: Need to read a small local file into a flow file property

Chris,

Are you looking to have a flow file that has its own content also as an 
attribute? With EvaluateJsonPath, are you taking in the entire document? If so, 
you could use ExtractText with a regex that captures all text and puts it in an 
attribute, I believe the content of the flow file is untouched.

Please let me know if I've misunderstood your use case, I'm a little confused 
as to why you have two paths and step 3. Wouldn't #1 and #2 (with 
"flowfile-attribute" as the Destination) read the file into an attribute and 
also keep it in the content?

Regards,
Matt

On Wed, Aug 24, 2016 at 4:33 PM, McDermott, Chris Kevin (MSDU - 
STaTS/StorefrontRemote) 
<chris.mcderm...@hpe.com<mailto:chris.mcderm...@hpe.com>> wrote:
Hi folks,

I’m looking for some ideas here.  I need to read the content of a small local 
file info a flow file attribute.  I can’t find a processor that does this.  Did 
I miss one that does?

So without one of these I’ve been trying to do this using a MergeContent 
processor.

First, I assign a correlation UUID and store it in an attribute

I split by file down two processing paths.  The left hand path goes straight to 
the MergeContentProcessors.

In the right hand path I

1.       Read the content of the local file using FetchFile

2.       Pull the content of the FlowFile into an attribute using 
EvaluateJSONPath

3.       Clear the content of the FlowFile using ReplaceText


Then I combine the left and right legs using MergeContent using the assigned 
correlation UUID to merge the files.

This generally works, except when it doesn’t. ☺

The problem seems to be that the left hand side of the stream flows relatively 
faster than the right hand path, which makes sense.  This can lead to the 
“bins” in the MergeContent processor being reused before the file in the bin 
can be merged with the file traveling down the right hand path causing 
Uncorrelated files are then sent to the merged output.

Does it sound like I am using the MergeContent processor in the right way?

Any other ideas?


Thanks in advance,

Chris McDermott

Remote Business Analytics
STaTS/StoreFront Remote
HPE Storage
Hewlett Packard Enterprise
Mobile: +1 978-697-5315

[cid:image002.png@01D1FEB1.02CE0E20]

Reply via email to