Skip to main content
Question

Poll REST Service until value changes


Forum|alt.badge.img

Good afternoon,

How would I poll a REST Service, check the value of a attribute (e.g. status), sleep if the attribute is not yet "completed" and then retry? (Ideally I'd implement a short-circuit if the time is exceeded, e.g. expose a attribute in Python and add a Tester).

In this diagram, it seems FME explicitly prevents the possibility of a looping structure?

Do I need to either:

 

Cheers.

7 replies

oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • June 21, 2018

david_r
Evangelist
  • June 21, 2018

I agree with @oscard.

An alternative to a looping transformer would be to do the polling inside a PythonCaller, using e.g. the urllib module.


Forum|alt.badge.img
  • Author
  • June 21, 2018
oscard wrote:
Thanks. Question I have is why doesn't FME support the "loop"?

gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • June 22, 2018

I've done something similar with a Creator that creates a large number of features going into a Decelerator that controls the sleep time.


Forum|alt.badge.img
  • Author
  • June 22, 2018
gazza wrote:

I've done something similar with a Creator that creates a large number of features going into a Decelerator that controls the sleep time.

Unfortunately the time will depend on the file size...

 

 


david_r
Evangelist
  • June 22, 2018
peterx wrote:
Thanks. Question I have is why doesn't FME support the "loop"?
It does, inside a custom transformer ;-)

jkr_wrk
Influencer
Forum|alt.badge.img+28
  • June 22, 2018

In this Workspace I put an example solution. It calls www.google.com every 10sec until the http status code is 200. Handy to use when your internet seems down.

wait-for-status-ready.fmw

In your case the Flattener and Exploder come inside the 'Wait for status ready' transformer in between the Http-caller and the Tester. I would recommend to use a Decelerator to trottle the calls. Else the server is busy answering your status request in stead of processing your data. And most of the time you just want the process to finish automagically and the delay is not significant.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings