Lee Chee Kiam
Lee Chee Kiam

Reputation: 12058

Record Oriented InvokeHTTP Processor

I have a csv file

longtitude,lagtitude
34.094933,-118.30674
34.095028,-118.306625
(more to go)

I use UpdateRecord Processor (which support record processing) with CSVRecordSetWriter using RecordPath (https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html) to prepare gis field.

longtitude,lagtitude,gis
34.094933,-118.30674,"34.094933,-118.30674"
34.095028,-118.306625,"34.095028,-118.306625"

My next step is to retrieve gis as input parameter to a HTTP API, where this HTTP API returns info (poi) that I would like to store.

longtitude,lagtitude,gis,poi
34.094933,-118.30674,"34.094933,-118.30674","Restaurant A"
34.095028,-118.306625,"34.095028,-118.306625","Cinema X"

It seems like InvokeHTTP Processor does not process in record oriented way. Any possible solution to prepare the above without split it further?

Upvotes: 2

Views: 525

Answers (1)

Bryan Bende
Bryan Bende

Reputation: 18630

When you want to enrich each record like this it is typically handled in NiFi by using the LookupRecord processor with a LookupService. It is basically saying, for each record in the incoming flow file, pass in some fields of the record to the lookup service, and take the results of the lookup and stored them back in the record.

For your example it sounds like you would want a RestLookupService:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-lookup-services-nar/1.9.1/org.apache.nifi.lookup.RestLookupService/index.html

Upvotes: 3

Related Questions