Anup,

I think I'm understanding now. Looks like you're getting bitten by a bug: 
https://issues.apache.org/jira/browse/NIFI-625

It should be addressed in the next version of NiFi.

So I realize this is a pain, but a work around that you can use in the mean 
time is to chain together two ReplaceText processors:

The first one, like you outlined below, would replace ".+" with:
filename: ${filename}

This should perform the replacement correctly because there's no enclosing { }.

Then second would then be configured with the Regular Expression set to "(.+)" 
and the Replacement Value set to:
{
$1
}

This will replace the "$1" with whatever value matches Capturing Group 1 of the 
regular expression - in this case the entire content of the FlowFile.

Please let me know if this helps!

Thanks
-Mark


----------------------------------------
> Date: Tue, 26 May 2015 21:31:11 -0700
> From: [email protected]
> To: [email protected]
> Subject: RE: send JSON format to kafka and avoid duplication
>
> Mark,
> That doesn't help. I'm getting the same results with the extra "$" too..
>
> Observation: If I have the curly braces around it doesn't replace the actual
> value (for the below ones)
> - {filename:${filename}}
> - {filename:$${filename}}
>
> But, if I omit the curly braces, the evaluation goes fine
> filename:${filename}
>
> Is there something like a 'eval' function or a backtick ` that I could use
> to evaluate and obtain the real filename inside a JSON like the below??
>
> {filename:eval(${filename}}
>
>
>
> --
> View this message in context: 
> http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/send-JSON-format-to-kafka-and-avoid-duplication-tp1624p1645.html
> Sent from the Apache NiFi (incubating) Developer List mailing list archive at 
> Nabble.com.
                                          

Reply via email to