These are chat archives for ReactiveX/RxJava

Feb 2018
Grigorii Tkachuk
Feb 16 2018 13:03
Hi guys! I have next question, I'm trying to use rxjava because I heard a lot that it's easy to handle situation when your api under high pressure on your service layer. I decided to try but it looks like I do not understand main idea. So imagine I have next method which exposed thru the REST endpoint @RequestMapping(method = RequestMethod.POST, value = "/pushData", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Single<String> pushData(@RequestBody String json) How I can slowdown a pressure on the logic inside this method? Is it a right way of thinking or I should slow it down the level of Undertow/Jetty/Netty by applying some strategy on it.
David Karnok
Feb 16 2018 14:16
@tkgreg Single implies a single result so backpressure is not really at play there. If you want to reduce the call frequency to pushData itself, there are ways for it, such as using concatMap or flatMap with concurrency limit, spanning out the source events over time, etc. You could also research Retrofit use cases similar to your problem.
Grigorii Tkachuk
Feb 16 2018 14:16
@akarnokd what is Retrofit?
public Single<String> pushJsonDataAsync(String json) {
        return Single.create(source -> {
            try {
                PushCrawlerDataRequest.Builder request = PushCrawlerDataRequest.newBuilder();
                JsonFormat.parser().merge(json, request);
                PushCrawlerDataResponse.Builder builder = pushData(;
            } catch (Exception ex) {
this is how I'm trying to use it right now