Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    hayaticakici
    @hayaticakici
    test
    Vu Minh Hoang
    @vuminhhoang
    still there ?
    I just tried
    it worked !
    Aditya Chaturvedi
    @apexkid
    @vuminhhoang Can you share code snippet on gist?
    Ignacio Baca Moreno-Torres
    @ibaca
    OMG hehe please try not to block and never ever subribe inside a subscription :astonished:
    As you said, you can chain the calls, for example using flatMap
    Aditya Chaturvedi
    @apexkid
    @ibaca Sounds weird to be as well. Whats the point of Rx if we have to block. :|
    That's true but i am not able to translate the Single<Completable> to Completable
    Ignacio Baca Moreno-Torres
    @ibaca
    What is the single and what is the Completable?
    In the app domain (ex a user get and a archive post)
    Aditya Chaturvedi
    @apexkid
    @ibaca Will it be possible to take a look at the stackoverflow link i shared? I have written in detail there. You will get entire context of the problem
    Ignacio Baca Moreno-Torres
    @ibaca
    Oh hehe OK
    Aditya Chaturvedi
    @apexkid
    Thanks! :)
    Ignacio Baca Moreno-Torres
    @ibaca
    uhm but you have already solved the chain problem
    Aditya Chaturvedi
    @apexkid
    It is not working.
    Ignacio Baca Moreno-Torres
    @ibaca
    yep, this is another problem, try to add the .subscribeOn(io()) in the save observable too
    it depends on how those methods are implemented (getToken and saveTokenToBackend)
    Aditya Chaturvedi
    @apexkid
    both methods are Retrofit api call
    Ignacio Baca Moreno-Torres
    @ibaca
    and the RxThreadCallAdapter should not handle this for you?
    are you configured that correctly?
    Aditya Chaturvedi
    @apexkid
    yes its working when i call it individually
    but not when i chain it
    Ignacio Baca Moreno-Torres
    @ibaca
    then just repeat the subscribeOn just after the api call
    Aditya Chaturvedi
    @apexkid
    brb
    Ignacio Baca Moreno-Torres
    @ibaca
    look like the API call apply the observeOn automattically (I think, not sure…)
    Ignacio Baca Moreno-Torres
    @ibaca
    uhm RxJava2CallAdapterFactory do not do that, not sure, anyways your problem MUST be that the flatMap has been evaluated on the mainThread so adding the subscribeOn must solve the problem, also, I really think that you should apply the RxJava2CallAdapterFactory using the RxJava2CallAdapterFactory.createWithScheduler(io()) call, that assert that all request call are evaluated in the io scheduler
    Aditya Chaturvedi
    @apexkid
    Thanks @ibaca . Your suggestion of changing the RxFactory worked. I still wonder why the issue was happening in the first place.
    I was already going .ObserveOn to my completable
    Ignacio Baca Moreno-Torres
    @ibaca
    :+1:
    Ewan Higgs
    @ehiggs
    hey hey. Do you reckon Maybe should have a version of just that takes an Optional<T> that translates it to .map(o -> Maybe.just(o)).orElse(Maybe.never()) ?
    Also, None of the .from methods seem to support CompletableFuture directly and some of them claim that there is some blocking behaviour when using fromFuture. Is that the correct bridge between CompletableFuture<?> and e.g. Single<?> ?
    Menkir
    @Menkir
    image.png
    Hey guys im trying to understand the purpose of subscribeON and observeOn.
    Am i right with my understanding?
    Dan O'Reilly
    @dano
    @ehiggs A lot of what you're suggesting is provided in https://github.com/akarnokd/RxJava2Jdk8Interop, fwiw
    Ewan Higgs
    @ehiggs
    @dano, thanks :)
    Dan O'Reilly
    @dano
    there's MaybeInterop.fromOptional, and mapOptional
    i think FlowableInterop does it, too
    it also has some fromFuture APIs, not sure if they provide what you're looking for, though
    Ewan Higgs
    @ehiggs
    I'm having a weird problem where I want to split a stream into var first = stream.firstOrError() and var rest = stream.skip(1). Then I do first.map(f -> someFunction(f, rest)). But when the first is done with that first element it cancels the rest of the stream which seems to hang up on rest. This is when using reactive-grpc... (I don't seem to be able to reproduce it using Flowable.just type tests even though cancel is called inside rxjava). is there a way to multiplex a stream like this?
    Volkan Yazıcı
    @vy
    Both RxJava 1 and 2 are both using j.u.c.ScheduledThreadPoolExecutor in default schedulers and hence have unbounded task queues, right?
    Ewan Higgs
    @ehiggs
    Is there a class to inherit for a pass-thru component where I can just fill in onNext, onComplete, etc? I get a lot of messy code when I have to keep state between map and doOnComplete. It would be a lot cleaner if I could just inherit some nice class that handles subscriptions and backpressure for me.
    Ignacio Baca Moreno-Torres
    @ibaca
    :astonished: onNext and clear in the same sentence
    hehe I like to think that rxjava is like joinig pipes…
    Pipes2.jpg
    hehe and this is the onNext operator…
    pipe-burst.jpeg
    Ewan Higgs
    @ehiggs

    Ha. :) I guess the interface might be something like:

    interface StreamProcessor<T, R> {
      R onNext(T data);
      void onError(Throwable t);
      void onComplete();
    }

    Then Flowable and friends can have

    Flowable<R> map(StreamProcessor<T, R> proc) {
        return this.map(proc::onNext).doOnError(proc::onError).doOnCompelete(proc::onComplete);
    }

    Maybe this exists already(?)

    Ignacio Baca Moreno-Torres
    @ibaca
    doOnEach