Java - 限制 SOAP API 调用
我正在构建一个向 SOAP API 发出请求的 Java 应用程序。 API 公开的某些方法会受到限制,并且这些方法具有不同的限制率,范围从 5 p/m 到 100 p/m。将所有请求限制为下午 5 点是不可接受的,因为某些方法(即具有较高限制限制的方法)必须更频繁地访问。
如何在我的项目中实现节流控制,允许我为不同的方法指定不同的节流限制?
干杯,
皮特
I'm building a Java application which 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Pete -
有几个问题:
一种通用方法是使用一个内部方法来跟踪用户、调用的方法以及允许调用该方法的速率,并返回一个布尔值来指示用户是否超出了限制。您希望此方法相当轻量,以便计算不会影响系统其余部分的性能,因为每个 API 调用都需要进行此检查。
Pete -
A couple of questions:
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.