So right now I'm trying to figure out how to solve this issue. I need to call an external resource (API) and pass to it an object collection.
So lets say, I have a sender like this:
public class Sender{
/// Send an message to an external api
public async Task Send(object[] objectCollection){
}
}
To problem is, there is a throughput limit on the API side. For example (5 objects per second). So I need to implement some kind of a waiting mechanism on my side(throttler) that will work with concurrent method calls inside a single APP.
- Is there a .NET throttler already or do I have to implement it myself?
- How would you implement the 5 objects per second rule?
My idea was to simply use an semaphore but that would only limit the concurrency and not account for the time limit.
Thanks for suggestions.