|
Can anyone recommend a good way to throttle calls to a webservice API that has transaction limits? I.e.: one call per second restrictions to a remote webservice. My first thought was to configure Task Scheduler to handle only one thread. Then whenever
someone needs to hit the webservice it spawns something like this (using <result>{fn:true()}</result>):
let $response := xdmp:http-get('http://some-webservice')
return
($response,
xdmp:sleep(seconds-from-duration(xs:dayTimeDuration('PT1S') - xdmp:elapsed-time()) * 1000))
This would keep requests to a maximum 1 per second, but anyone calling it with an empty queue would still have to wait the full second to get their result. Also, if anything else relied on Task Server being able to execute tasks with multiple threads,
this would break it.
-Will
|
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
