开发者

Java - Throttling SOAP API calls

开发者 https://www.devze.com 2023-02-15 03:10 出处:网络
I\'m building a Java application 开发者_如何学Gowhich makes requests to a SOAP API. Certain methods that the API exposes are throttled and these methods have different throttling rates, ranging from 5

I'm building a Java application 开发者_如何学Gowhich makes requests to a SOAP API. Certain methods that the API exposes are throttled and these methods have different throttling rates, ranging from 5 p/m to 100 p/m. It's not acceptable to limit all requests to 5 p/m as some methods (i.e. the ones with higher throttling limits) must be accessed more frequently.

How can I implement throttling control in my project which allows me to specify different throttling limits for different methods?

Cheers,

Pete


Pete -

A couple of questions:

  • Is this throttling being done on a per-user basis?
  • Do your API calls include a way to uniquely identify the caller?
  • What behavior are you looking for when the limits are exceeded?

One general approach is to have an internal method that tracks the user, the method called, and the rate at which it's allowed to be called, and returns a boolean indicating whether the user has exceeded their limits. You want this method to be fairly lightweight so that the calculation doesn't impact performance of the rest of the system, since every API call will require this check.

0

精彩评论

暂无评论...
验证码 换一张
取 消