Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    @mattblang If you need a real circuit-breaker, you could use https://github.com/RobWin/circuitbreaker-java8
    but I assume yon mean something different with short-circuit.
    Denis Stepanov
    @dstepanov
    I just want to keep the original error in the Observable, not the wrapper like ExecutionException etc.
    Matt Langston
    @mattblang

    @RobWin Maybe I should use different wording than short-circuit. Basically, I just want to end a series of calls in a flatMap if an Exception happens. See this SO ticket, I detailed my issue with a sample.

    http://stackoverflow.com/questions/31440271/short-circuit-a-flatmap-if-an-exception-occurs

    Dries De Smet
    @Busata
    hi, if I have an observable.from(listwithintegers).flatmap(new func1<Integer,SomeOtherClass>{ ... CODE ... }), and I want the code in flatmap to be executed in parallel since the ...CODE... blocks, why can't I just add a subscribeonscheduler on the flatmap? it works if the code is Observable.just(integer).map(blocking code).subscribeon, but not in the flatmap itself
    Dries De Smet
    @Busata
    https://gist.github.com/Busata/ccd000ff6426a9cdb4d3 eg, this, is it possible to let the flatmap run in parallel? (with that code it doesn't)
    David Stemmer
    @weefbellington
    @dstepanov are you using RxJava or another ReactiveX library? If you're using RxJava, maybe you could try (.onErrorResumeNext)
    @dstepanov the input to the .onErrorResumeNext would be a function that unwraps the Exception and returns a new Observable, which you would create with Observable.error(unwrappedException)
    David Stemmer
    @weefbellington
    @Busata I could be wrong but the way I read this is that when .subscribe is called it will execute the flatmap code on a computation worker thread, and that worker thread will block each time Thread.sleep is called
    in other words, the observable code will be running on a worker thread, but the code in flatmap will be serialized, not parallelized
    AFAIK there used to be a .parallel operator in RxJava but they removed it because its behavior was confusing
    what I might try (and I'm not sure if this is the right approach) is using Schedulers.trampoline to schedule some work in the flatmap function, and then return thread execution to the original Schedulers.io thread
    David Stemmer
    @weefbellington
    .flatMap(new Func1<Integer, Observable<Hotel>>() {
        @Override
            public Observable<Hotel> call(Integer coordinate) {
                Schedulers.trampoline().createWorker().schedule(new Action0() {
                     // ...your code here...
                });
            }
    })
    it's similar to the problem I posted above
    Pavel Meledin
    @btbvoy
    How to build Rx* application that will be ready:
    1. To scale on multiple machines? How to manage parallel execution of requests inside cluster of machines? How to split request processing between nodes in cluster?
    2. How to calculate amount of used resource and bandwidth of single node. In order to have some kind of flat progress bar that will indicate that 78 of 100% is used and approximately 20-70 extra requests certain node can handle and later we need to put extra node into cluster?
    David Stemmer
    @weefbellington
    @Busata that might be tricky because you need to return an Observable though...you could also try:
    .flatMap(new Func1<Integer, Observable<Hotel>>() {
        @Override
            public Observable<Hotel> call(Integer coordinate) {
                return Observable.just(coordinate)
                    .map(new Func1<Integer, Hotel>() {
                        @Override
                        public Hotel call(Integer coordinate) {
                            // ...your code here...
                        }
                    }
                    .subscribeOn(Schedulers.io);
                });
            }
    })
    inlining this crap is so ugly, ugh
    Denis Stepanov
    @dstepanov
    @weefbellington Thanks! that actually works!
    David Stemmer
    @weefbellington
    @dstepanov which one lol
    Denis Stepanov
    @dstepanov
    .onErrorResumeNext(e -> Observable.error(e.getCause())) ;)
    David Stemmer
    @weefbellington
    spoiled Java 8 people with your lambdas
    Matt Langston
    @mattblang
    @weefbellington Haha, I know right. (on Android Java 7 here)
    Dmitriy Tarasevich
    @darussian
    the struggle is real..
    David Stemmer
    @weefbellington
    is anybody here using Retrolambda (specifically, gradle-retrolambda) in a production Android app?
    MightySeal
    @MightySeal
    @weefbellington nope. Waiting for kotlin's incermental compilation instead =)
    Matt Langston
    @mattblang
    @weefbellington I know Dan Lew mentioned on the Fragmented podcast that he uses it in production. I haven’t been brave enough yet.
    Bartłomiej Hołota
    @bholota
    @weefbellington I tried use it on production, but sometimes I got NoClassDefFoundError issue and switched this library off. I was annoying to do full, clean build in big project everytime this error occured. I don't know if it's working now, I was trying this library few months ago.
    Denis Stepanov
    @dstepanov
    What is the best way to implement reactive event bus? Guava maybe? Or it's possible to use only RxJava api?
    Artem Zinnatullin :slowpoke:
    @artem-zinnatullin
    @dstepanov take a look at PublishSubject, it can replace almost every Event Bus implementation.
    Denis Stepanov
    @dstepanov
    @artem-zinnatullin Thanks, that is exactly what I was looking for
    Artem Zinnatullin :slowpoke:
    @artem-zinnatullin
    @dstepanov glad to help :)
    Matt Langston
    @mattblang
    How could I stop the calls in a flatMap if an error happens somewhere in the chain?
    http://stackoverflow.com/q/31440271/1747491
    Andrew Reitz
    @pieces029
    Just wondering, why are you forcing the schedular back on the main thread a bunch?
    Don't you want to run in the background until you have your results (granted retrofit will force it on the background anyways).
    Also, the answer seems correct, what do you not like about it?
    Matt Langston
    @mattblang
    @pieces029 I need to update the progress UI along the way as I retrieve various data (auth token, then progress, etc.), which requires coming back to the main thread. I made a comment on the answer as to why it didn’t work. I was originally trying to do it like that.
    Yuriy Badalyantc
    @LMnet
    Hi everybody. Is there any "statefull reactive variable" in rx? Something like finite state machine?
    Denis Stepanov
    @dstepanov
    Do I understand correctly that if a subscriber throws an exception it'll be unsubscribed?
    Is there a way to keep the failing subscriber?
    Artem Zinnatullin :slowpoke:
    @artem-zinnatullin

    2 Ways:

    1) Don't throw exception as error signal, because it terminates Observable
    2) Materialize operator

    Denis Stepanov
    @dstepanov
    I'm using PublishSubject and I would like to catch an exception at onNext if any of the subscribers throws an exception
    Artem Zinnatullin :slowpoke:
    @artem-zinnatullin
    Matt Langston
    @mattblang
    has anyone used TestSubscriber for unit testing? I’m trying to assertError, but I am getting an AssertionError that Exceptions differ. However, it says java.net.SocketTimeoutException and the actual should be java.net.SocketTimeoutException
    Matt Langston
    @mattblang
    Wups, it is because assertError needs the .class, because Throwable doesn’t implement .equals, thus doing a reference comparison
    Dirk T.
    @DirkToewe
    Is there a Software/Tool/Plugin that allows to connect Observables similar to Matlab Simulink or Maybe in the Form of the Marble Diagrams?
    I forgot the most important key adverb: VISUALLY :smile:
    David Stemmer
    @weefbellington
    @DirkToewe maybe you could try http://rxmarbles.com/?
    I'm not sure if that's exactly what you want
    Bartłomiej Hołota
    @bholota
    I'm trying to understand defer(), should I use it in case when I'm creating Observable from list of Strings, map those into File and just after that subscribe to it? Should this observable be deffered or not?