Joe,

Thanks for the reply.  I think I was not clear.

The JSON I need to evaluate is in a FlowFile attribute (kafka.key) which I need 
to be able to evaluate without modifying the original FlowFile content (which 
was read from the Kafka topic).  What I can’t figure out is how to squirrel 
away the flowfile content so that I can write the value of the kafka.key 
attribute to the FlowFile content, so that I can process it with 
EvaluateJsonPath, and then read content I squirreled away back into the 
FlowFile content. I considered using the the DistributedMapCache, but there 
would be no guarantee what I added to the cache would still be there when I 
needed it back.




On 3/21/16, 1:37 PM, "Joe Witt" <joe.w...@gmail.com> wrote:

>Chris,
>
>Sounds like you have the right flow in mind already.  EvaluateJSONPath
>does not write content.  It merely evaluates the given jsonpath
>expression against the content of the flowfile and if appropriate
>creates a flowfile attribute of what it finds.
>
>For example if you have JSON from Twitter you can use EvaluateJsonPath
>and add a property with a name
>'twitter.user' and a value of '$.user.name'
>
>Once you run the tweets through each flow file will have an attribute
>called 'twitter.user' with the name found in the message.  No
>manipulation of content at all.  Just promotes things it finds to flow
>file attributes.
>
>Thanks
>Joe
>
>On Mon, Mar 21, 2016 at 1:34 PM, McDermott, Chris Kevin (MSDU -
>STaTS/StorefrontRemote) <chris.mcderm...@hpe.com> wrote:
>> What I need to do is read a file from Kafka.  The Kafka key contains a JSON 
>> string which I need to turn in FlowFile attributes while preserving the 
>> original FlowFile content.  Obviously I can use EvaluteJsonPath but that 
>> necessitates replacing the FlowFile content with the kaka.key attribute, 
>> thus loosing the original FlowFile content.  I feel like I’m missing 
>> something fundamental.

Reply via email to