Baseline :
There is a project that uses methods from the third-party project SDK (asynchronous methods for working with their server with a callback parameter) and contains Retrofit2 + OkHttp + Rx for working directly with the server. For convenience, used lambda.
Task :
It is necessary that all requests (from both the SDK and Retrofit) are executed no more than 5 times per second, and if the limit is exceeded, they are executed with a delay.
Question :
How to implement it? The first thing that comes to mind is Service + BroadcastReceiver. But you will have to listen to the receiver in each activit / fragment, plus you will get a less convenient implementation of callbacks ... Maybe you can somehow implement this with Rx (including wrapping SDK methods) to leave the lambdas for convenience?