We have a process that needs to call a Rest API that enforces fair usage via request throttling. The API limits the number of calls in a rolling 1 minute window, and will return a http 503 error when too many calls are made.
We have implemented this using a try/catch around the http connector, and explicitly throwing an exception on the response if the http code is 503.
Here we read a header from the response, which is used in a groovy script on the catch to force a delay. The catch branch then feeds directly back in to the http connector to repeat the request.
The issue is if there are multiple documents, they are all executed together so if the 5th of 500 documents results in an http 503 response the remaining 495 are still sent before the exception route is processed.
The question is, if we insert a flow control into this to process the documents separately what would the scope be, given that this logic is contained within a separate process.
Would the flow control stop at the return document shape, or propagate back up to the calling process?