I’m using an HTTP client which returns
Futures. I’m making a sequence of calls against a REST API, with each call corresponding to an item in a source collection. I have the following requirements:
- The calls shall be made in the same order as the order of items in the collection.
- The next call should only be made after the previous have completed (with either success or failure).
It’s possible to compose futures in a way that will achieve this. However, an argument could be made that this should be solved by the
ExecutionContext instead, as after all this is what controls the execution.
So the question is, how could one create an
ExecutionContext which will satisfy these requirements?