Reputation: 21
I am making third party GET API calls which has per second 10 requests rate limit .How can successfully control http GET requests to avoid hitting rate limits of third party. I am using Vertx Webclient for making GET request.
Upvotes: 0
Views: 1056
Reputation: 2874
two ways to do it with CompletableFutures:
CompletableFuture
s that make your requests then send the thread to sleep for 1s - see runAsync()
and supplyAsync()
methods.CompletableFuture
and sleep 1/10th of a second.If you store the CompletableFutures in a list/map (whatever works for your situation best) you can then .get()
the answers later when you need to access the results.
Upvotes: 0