Hey there. What might be a nice way to restrict (throttle) the number of http requests that can come in for a particular service? I have a service that I’d like to restrict to serving just one http request at a time, whereas other routes are cheap to service and can be done so more regularly.
I had thought of using a BroadcastHub and completing my route with a source produced from the hub, but there are some parameters from my http request that I need to feed into the service so this isn’t possible. Also, a BroadcastHub would can only limit producing sources to a minimum of two at a time (a buffer of 0 is not permitted).
Something like this might be nice:
pathPrefix("some-path")( (get & paramDateRange)((startDate, endDate) => complete( async(1)( // <-- Ficticious directive that limits the request rate to 1 at a time SomeService.doSomethingWithDates(startDate, endDate) ) ) ) )