You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Jeff - Data Bean Australia <da...@gmail.com> on 2016/02/16 05:14:00 UTC

Using the Content of a FlowFile in NiFi Expression Language?

Hi,

The ${ attribute } expression can help using attributes of a FlowFile in
NiFi Expression Language, but what about the content?

For example, if there is only one line in a FlowFile and I would like to
use it as part of my URL for InvokeHTTP processor, how can I do it?

Thanks,
Jeff

-- 
Data Bean - A Big Data Solution Provider in Australia.

Re: Using the Content of a FlowFile in NiFi Expression Language?

Posted by Conrad Crampton <co...@SecData.com>.
Hi,
This is exactly what I am using NiFi for mostly – parsing log files that have one line per FlowFile. To supplement Aldrin’s answer, I am doing exactly this – using regexp to parse the FlowFile content (in some cases I am also pre-processing the line with ReplaceTextWithMapping (for lookup values), then using AttributesToJson to make the FlowFile a single line of Json thus converting semi structured to a known format. I then convert to Avro finally amongst other things.
Hope that helps.
Conrad

From: Aldrin Piri <al...@gmail.com>>
Reply-To: "users@nifi.apache.org<ma...@nifi.apache.org>" <us...@nifi.apache.org>>
Date: Tuesday, 16 February 2016 at 04:35
To: "users@nifi.apache.org<ma...@nifi.apache.org>" <us...@nifi.apache.org>>
Subject: Re: Using the Content of a FlowFile in NiFi Expression Language?

Jeff,

This would easily be handled by ExtractText [1] wherein you can specify a regex to extract values from the content and add them as attributes on the FlowFile.  For your case, you could use an ExtractText instance with a dynamic property of a desired attribute name and regular expression.  The InvokeHTTP could then make use of the attribute extracted via Expression Language as you highlighted in your original message.

[1] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.ExtractText/index.html

On Mon, Feb 15, 2016 at 11:14 PM, Jeff - Data Bean Australia <da...@gmail.com>> wrote:
Hi,

The ${ attribute } expression can help using attributes of a FlowFile in NiFi Expression Language, but what about the content?

For example, if there is only one line in a FlowFile and I would like to use it as part of my URL for InvokeHTTP processor, how can I do it?

Thanks,
Jeff

--
Data Bean - A Big Data Solution Provider in Australia.




***This email originated outside SecureData***

Click here<https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==> to report this email as spam.


SecureData, combating cyber threats
______________________________________________________________________ 
The information contained in this message or any of its attachments may be privileged and confidential and intended for the exclusive use of the intended recipient. If you are not the intended recipient any disclosure, reproduction, distribution or other dissemination or use of this communications is strictly prohibited. The views expressed in this email are those of the individual and not necessarily of SecureData Europe Ltd. Any prices quoted are only valid if followed up by a formal written quote.

SecureData Europe Limited. Registered in England & Wales 04365896. Registered Address: SecureData House, Hermitage Court, Hermitage Lane, Maidstone, Kent, ME16 9NT

Re: Using the Content of a FlowFile in NiFi Expression Language?

Posted by Aldrin Piri <al...@gmail.com>.
Jeff,

This would easily be handled by ExtractText [1] wherein you can specify a
regex to extract values from the content and add them as attributes on the
FlowFile.  For your case, you could use an ExtractText instance with a
dynamic property of a desired attribute name and regular expression.  The
InvokeHTTP could then make use of the attribute extracted via Expression
Language as you highlighted in your original message.

[1]
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.ExtractText/index.html

On Mon, Feb 15, 2016 at 11:14 PM, Jeff - Data Bean Australia <
databean.au@gmail.com> wrote:

> Hi,
>
> The ${ attribute } expression can help using attributes of a FlowFile in
> NiFi Expression Language, but what about the content?
>
> For example, if there is only one line in a FlowFile and I would like to
> use it as part of my URL for InvokeHTTP processor, how can I do it?
>
> Thanks,
> Jeff
>
> --
> Data Bean - A Big Data Solution Provider in Australia.
>