Imported Google Group message.
Sender:Khirod Kant Naik.
Date:Sunday, 8 February 2015 13:56:27 UTC.
The throttler in Tyk operates across the whole API definition, which means any API endpoints it manges within that definition are throttled the same way.
To get something like this working you could use some clever redirects though:
For each endpoint, create a seperate API definition, this will mean that this API definition will need to listen on a new path (multiple defs cant listen to the same inbound URL). However you could then use NGinX to proxy traffic upstream according to your existing API endpoint configuration, this way the interface to your API is the same across the board, but Tyk is treating inbound requests as different Definitions and therefore will apply different throttlers to those endpoints.
It’s a bit complicated, and could mean having many definitions which make it hard to manage a configuration, but you will get the result you want.
For the second part of your request, I’m not sure we can help with anything out-of-the-box: all throttled requests are blocked, so redirecting them into a queue isn’t possible, though you could develop a custom event handler that handles the throttle event and passes it the raw request, currently event handlers only get limited metadata about the event (path, key, event), but it should be possible to pass the entire request data through, though you run the risk of having many long-lived goroutines and potentially flooding your queue / ESB.
It’s an interesting idea to make the request available to the event handler, I’ll add it to the roadmap as it could be useful to others.
Hope that helps
On Sunday, February 8, 2015 at 1:35:19 PM UTC, Khirod Kant Naik wrote:
I wanted to make sure if it is possible to throttle requests on API endpoints ?
Basically our use case is we want to limit the number of calls on different API endpoints and queue any of those additional requests so that they can be handled later ? Any suggestions …