Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dorus
    @Dorus
    @newprint We've been working with Rx for some time and know a bit more about it. However i'm afraid you did not tell us enough about the problem to give you any hints :)
    Alexander Dorfman
    @alexander-dorfman
    give me a sec, I will describe a problem
    Lalit Maganti
    @tilal6991
    @eneim if you look at the issues you'll see one of the main devs posted a difference between it and rxjava
    Alexander Dorfman
    @alexander-dorfman

    Here is my problem
    I have two classes, RAnalyticsEngine - http://pastebin.com/iZFC4DHv
    and second class RAnalyticsServiceImp - http://pastebin.com/9ZtDLb7Q

    Notice that RAnalyticsServiceImp creates Observable<RAnalyticsEngine > in line 60

    I suspect, that I don't create Observable<RAnalyticsEngine > correctly, since .create() method is never being called.
    .create method initializes some of the parts of RAnalyticsEngine.
    So, main problem is, how to correctly create Observable<RAnalyticsEngine > from within RAnalyticsServiceImp?
    Alexander Dorfman
    @alexander-dorfman
    Thank you for any help !
    Artem Kochkin
    @kolipass

    Hello. I need a multithreading processing for my collection. I tried to

    1. Create ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(coreCount);
    2. Create Observable<Observable<N>> source, that emit as many Observable.just(list.subList(start,finish)); as coreCount. For each new Observable do subscribeOn(Schedulers.from(threadPoolExecutor))

    Or may be there is some operator for that task?

    Abhinav Solan
    @eyeced
    Hi, need help regarding a problem I have, there is stream of data (an iot device reads), now there are some validations which that data needs to go through, for e.g. are the values in the data valid, or the configuration of that data is valid or not, these are like some nested if else conditions on that data .. and I cannot filter data, it's just that of the read is valid or not it would be going to a certain source .... I have tried using groupBy but it is increasingly getting messy with my code. Are there any suggestion on what I can use to make my code remain functional and good as well ?
    AlexShutov
    @AlexShutov
    @eyeced you may try to make your validator accepting individual items and process stream by .lift()
    Alon Dolev
    @ayedo
    Hi! I used rx.fileutils.* to create an Observable of FileSystemEvents, and I subscribed some simple print function to it. To test this application, I created a blockingObservable and called last() on it. I do not expect this to ever return a value, I just wanted something to block. Because of this last() call , only every other file modification event comes through to the println subscriber. I stepped through the code, and found that the missing events got consumed by the OperatorTakeLasts "call" function. Did I do something wrong? What is going on here? Here is the code: https://gist.github.com/ayedo/7c54b224f84193899650fde3824b4251
    Boy Wang
    @boyw165
    Does rx-java provide facility such as the weak subscription like the following?
    http://blog.functionalfun.net/2012/03/weak-events-in-net-easy-way.html
    Boy Wang
    @boyw165
    Oh the author updated the conclusion, Activities won’t maintain strong references to their anonymous inner classes unless you store those classes in an instance variable, so technically, you’d have to store your Subscribers in instance variables to prevent them for being garbage collected.. So don't worry about the leak from anonymous inner classes.
    Adrian
    @AdrianoCelentano
    i have a Composite subscription in my Viewmodel, each time a button is clicked i subscribe to an observer. After clicking severall times i have a lot of subscription in my compositeSubscription. Should i unsubscribe after each request ?
    Volkan Yazıcı
    @vy
    Hey all! I have a stream of HttpResponse's of type Observable<HttpResponse>. I want to return the first success in the first 3 items, otherwise return the 3rd error message. (Basically, I am trying to implement a "retry at most 3 times if fails" HTTP driver.) Is there a way to achieve this via RxJava sorcery?
    Dorus
    @Dorus
    @AdrianoCelentano why not one constant subscriber?
    @vy did you try retry(3)?
    Adrian
    @AdrianoCelentano
    @Dorus you mean reusing one single suscriber ?
    Dorus
    @Dorus
    @AdrianoCelentano Yes: You put an eventListener on the button, and each time it's clicked you merge the resulting actions into the stream, leaving lifetime management to that single subscription.
    I could give some examples, but i'm not sure what you are subscribing at right now.
    Volkan Yazıcı
    @vy
    @Dorus retry(3) does not work as I expect it to: https://gist.github.com/vy/f3998912d3649f3201f6350bd081b3b5 throws an exception.
    Dorus
    @Dorus
    Because you resubscribe to concat, and concat will then emit the first observable (including exception) again.
    Volkan Yazıcı
    @vy
    @Dorus I was afraid of that. Any other way to test my impl?
    Dorus
    @Dorus
    i think you need a different operator, i beliece catch would work
    o0.catch(o1).catch(os) if i'm right.
    instead of retry.
    *onErrorResumeNext i mean
    Volkan Yazıcı
    @vy
    @Dorus But in my actual code, "Observable<Integer> os" is provided by another function. Hence, I have no idea (and I better shouldn't) on how it is generated.
    Dorus
    @Dorus
    But if you subscribe a second time, it might return a different (no exception) value?
    ooh you want to test that. ok
    int count = 0;
    Observable<Integer> source = Observable.create(ob -> {
       switch(count++) {
          case 0:
              Observable.error(new Exception()).subscribe(ob);
              break;
          case 1:
              Observable.just(1).subscribe(ob);
              break;
         case 2:
              Observable.concat(o0, o0, o1).subscribe(ob);
              break;
       }
    });
    Something like that
    Volkan Yazıcı
    @vy
            AtomicInteger counter = new AtomicInteger(0);
            Observable<Integer> os = Observable.create(subscriber -> {
                int count = counter.getAndIncrement();
                if (count < 3) subscriber.onError(new Exception());
                else subscriber.onNext(count);
            });
            Integer value = os.retry(3).toSingle().toBlocking().value();
    @Dorus This hangs after 3rd call. Any ideas?
    Dorus
    @Dorus
    because your source never completes.
    Volkan Yazıcı
    @vy
    Fsck! Prepending a first() before toSingle() solved the problem. Thanks.
    Dorus
    @Dorus
    else {
      subscriber.onNext(count);
      subscriber.onCompleted();
    }
    Volkan Yazıcı
    @vy
    Nope, I do not want to complete the stream.
    Dorus
    @Dorus
    Yeah that would work too, first() will also close the stream for you
    Well, i mean, a propperly set up Observable.create should always finish with a onCompleted or onError messages
    Alessandro Vermeulen
    @spockz
    Forgive my ignorance but shouldn't Observable.error(someThrowable).doOnComplete(println("done")) always print "done"?
    This is what I'm actually running but what doesn't produce any output:
        val obs = rx.Observable.error(new IllegalStateException("foo"))
        obs.doOnError(new Action1[Throwable] {
          override def call(t: Throwable): Unit = println(t)
        })
        obs.doOnCompleted(new Action0 {
          override def call(): Unit = println("DOne")
        })
    David Stemmer
    @weefbellington
    there's been some talk on ASG (Android Study Group, an invite-only Android slack channel) about having a better place for rxjava public chat / technical discussion
    ASG is very active and has a very enthusiastic rxjava community
    but because it's invite-only and Android-specific, it's kind of isolated from the rest of the RxJava community
    Alessandro Vermeulen
    @spockz
    @weefbellington , was that a remark regarding my question?
    Dorus
    @Dorus
    @spockz No, that wont print because the observable did not end in onCompleted, it ended in onError
    Also you are creating 2 new observables
    So you can only subscribe to one like that
    The correct way is
    val obs = rx.Observable.error(new IllegalStateException("foo"))
        .doOnError(new Action1[Throwable] {
          override def call(t: Throwable): Unit = println(t)
        })
        .doOnCompleted(new Action0 {
          override def call(): Unit = println("DOne")
        });