Skip to main content
Question

Poll REST Service until value changes

  • June 21, 2018
  • 7 replies
  • 53 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

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

david_r
Celebrity
  • 8391 replies
  • 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
  • 49 replies
  • June 21, 2018
Thanks. Question I have is why doesn't FME support the "loop"?

gazza
Contributor
Forum|alt.badge.img+6
  • Contributor
  • 132 replies
  • 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
  • 49 replies
  • 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.

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

 

 


david_r
Celebrity
  • 8391 replies
  • June 22, 2018
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+35
  • 424 replies
  • 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.