I am using RestTemplate
and Spring Boot to call an external service which have rate limiting, in place.
For example, if we send more than 10 requests at once, it will throw an error stating- "Too Many Requests".
How can I make sure as a client to not send more than 10 requests at once and also not loosing any incoming requests to me?
Can anyone help me with that?
Edit:
I had an idea of maintaining queue and send requests one by one. But its not optimal to send one request at a time when server can handle 10 requests. Thus, using this approach does not seem optimal.