Hacker News new | ask | show | jobs
by shadowmatter 3405 days ago
Retrofit has support for RxJava, both of which are mentioned on the list. If Retrofit deserializes your JSON response payload as type T, then upon making a request it will return an Observable<T> that will either emit the result (if the request succeeds) or emit an Exception (if it fails).

Most Android applications that rely on both Retrofit and RxJava use them together in this manner.

As for too many requests pending, I'm not sure if OkHttp (which Retrofit uses for making requests and is again on that list) is configurable in that regard. If you want to handle it at the application level, you could maybe model the request queue to the network layer as an Observable<Request> and use RxJava's backpressure operators.

For more information on functional reactive programming (which I would call promises or CompletableFuture done better), see http://reactivex.io/

And for more information on RxJava, see https://github.com/ReactiveX/RxJava