Support Questions
Find answers, ask questions, and share your expertise

Get attribute from ListenHTTP request processor

Get attribute from ListenHTTP request processor

New Contributor

Hi, 

 

I've a flow whose input is a ListenHTTP processor. When this processor receives a request, I'd like to get the "restlistener.remote.source.host" attribute from it. I've seen this attribute here: https://ddewaele.github.io/http-communication-with-apache-nifi/#ListenHTTP Could anyone tell me it this is possible? Is there any method like getAttribute to achieve this?

 

Thanks!

3 REPLIES 3
Highlighted

Re: Get attribute from ListenHTTP request processor

What format is the data coming out of listenHttp? Maybe show an example.

 

Based on that data you will need to use an appropriate processor. For example; evaluatejson if json.  Other types like text, csv, Avro, xml, parquet, etc have their own procs and readers.

 

To get existing attributes saved as a new name you use UpdateAttribute, or to use them in downstream procs you access the attributes as follows:

 

${restlistener.remote.host.source}

 

i recommend to list the queue and view the attributes then copy the name you want into the ${attribute} syntax.

Highlighted

Re: Get attribute from ListenHTTP request processor

New Contributor

Hi Steven, 

 

The next processor I'm using is EvaluateJSONPath

Captura de pantalla 2020-01-12 a las 20.03.58.png

Highlighted

Re: Get attribute from ListenHTTP request processor

For evaluate json you click the + and make a new attribute name:

 

     newAttributeFromJsonObject

 

in the value you enter:

 

     $.path.to.json.object