Created 06-08-2018 08:46 AM
Hi,
I'm using Nifi to pull GPS data from a server using http request.
The request has a parameter "T", allowing the user to get the GPS reports made since "T".
The response give a list of GPS reports, followed by the timestamp of the last report made.
I want to be able to save the timestamp returned by the last request, in order to use it for my next request.
To be ultra clear : when I launch my NiFi flow, I want to use "T=0" in my request (which return me the last reports for all cars), then use the timestamp returned to execute the next request (to get only the ones which made a report since the last call), and so on.
Is there an elegent way to do that?
Thx a lot.
Created 06-08-2018 03:52 PM
-
My initial thought would be to use the PutDistributedMapCache and FetchDistributedMapCache processors.
-
You would nee to setup a flow that uses a GenerateFlowFile and PutDistributedMapCache processors to created the initial cache entry with a value of "0".
-
Then in your main flow, Generate a FlowFile (how ever you want to routinely trigger main flow) --> FetchDistributedMapCache (retrieve current cached value) --> make request based on cached value retrieved --> PutDistributedMapCache (update stored cached value with new timestamp) --> rest of flow...
-
This gives you a way to constantly update a value in cache that can be used.
-
Thanks,
Matt
-
When an "Answer" addresses/solves your question, please select "Accept" beneath that answer. This encourages user participation in this forum.
Created 06-08-2018 03:52 PM
-
My initial thought would be to use the PutDistributedMapCache and FetchDistributedMapCache processors.
-
You would nee to setup a flow that uses a GenerateFlowFile and PutDistributedMapCache processors to created the initial cache entry with a value of "0".
-
Then in your main flow, Generate a FlowFile (how ever you want to routinely trigger main flow) --> FetchDistributedMapCache (retrieve current cached value) --> make request based on cached value retrieved --> PutDistributedMapCache (update stored cached value with new timestamp) --> rest of flow...
-
This gives you a way to constantly update a value in cache that can be used.
-
Thanks,
Matt
-
When an "Answer" addresses/solves your question, please select "Accept" beneath that answer. This encourages user participation in this forum.
Created 06-11-2018 08:43 AM
Thanks a lot, I'll try this solution and will report whether it's working or not after testing it 🙂
Created 06-12-2018 02:24 PM
Ok, for the record :
I've tried your solution and it's working, but I found a simpler solution : I changed my "GetHTTP" processor for a "InvokeHTTP" processor, which allows input FlowFile. Then I've linked the response of my request back to the "InvokeHTTP", which allows me to trigger my request when the previous request is done, instead of triggering it with a "GenerateFlowFile" processor.
Thanks a lot ! 🙂