Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Oleh Dokuka
    @OlegDokuka
    oh
    updated last link
    Amit Kumar Pandey
    @pandeyam
    ok
    and after this ?
    Oleh Dokuka
    @OlegDokuka
    then
    there is an interesting online playground, but for Reactor 3 , so you may play around there -> https://tech.io/playgrounds/929/reactive-programming-with-reactor-3/Intro
    desclimer Reactor is identical to RxJava 2 but written using Java 8
    Amit Kumar Pandey
    @pandeyam
    ok
    is there any good book
    ??
    Oleh Dokuka
    @OlegDokuka
    I would suggest one greate book from the friend of mine called Reactive Programming with RxJava
    Amit Kumar Pandey
    @pandeyam
    wow.. please name that book
    Oleh Dokuka
    @OlegDokuka
    Reactive Programming with RxJava
    :D
    Amit Kumar Pandey
    @pandeyam
    bhai writer ka naam bta
    writer name ?
    Oleh Dokuka
    @OlegDokuka
    Tomasz Nurkiewicz and Ben Christensen, second guy is the main developer of RxJava 1
    Amit Kumar Pandey
    @pandeyam
    ok
    Exerosis
    @Exerosis
    Is there anything like this built into rxjava? https://gist.github.com/Exerosis/99b298de98fc811d4d0459418407c201
    Ankush Grover
    @groverankush

    Hi everyone. I have a question. I have asked it on stackoverflow. Can anybody answer it?

    https://stackoverflow.com/questions/49315063/what-is-the-best-practice-for-using-room-with-rxjava

    David Karnok
    @akarnokd
    @Eerosis There is nothing like it built in. You can write it this way and avoid blocking: upstream -> upstream.flatMapSingle(up -> source.firstOrError().map(from -> combiner.apply(up, from)));.
    Exerosis
    @Exerosis
    @akarnokd Ah ok, yeah that would be better, thank you!
    Fabricio
    @ofabricio
    hi, is there a gitter specific for Java language?
    defaultbr
    @defaultbr

    Hello guys, i have some doubts about chaining operation base on result for example:

      checkCode(code)
                                .subscribeOn(scheduler.io())
                                .observeOn(scheduler.ui())
                                .subscribe(
                                        { response ->
                                            if (response.isSuccessful) {
    
                                            } else {
                                                handleErrorBody(response)
                                            }
                                        },
                                        { error ->
                                            handleError(error)
                                        })
                )

    in the response.isSucessful i can extract the body from retrofit response and than save on database, but it will be in main thread (i know how to start another one observable or kotlin functions to do on back) but im trying to chain inside the Rx

    My problem resides when i create a doOnNext and save:

                        checkCode(code)
                                .doOnNext({ it -> saveToDb(it)})
                                .subscribeOn(scheduler.io())
                                .observeOn(scheduler.ui())
                                .subscribe(
                                        { response ->
                                            if (response.isSuccessful) {
                                                view?.showDataSaved()
                                            } else {
                                                handleErrorBody(response)
                                            }
                                        },
                                        { error ->
                                            handleError(error)
                                        })
                )

    and inside the handleError i check if which kind of exception was, is that correct? the exception thrown inside the savedToDb will be catch on subscribe exception or not? is this a good approach?

    James Nelson
    @JamesXNelson
    use triple `
    defaultbr
    @defaultbr
    done =)
    thx
    Prashant Singhal
    @PrashantSinghal

    In this file SampleMVI_ViewModel , I'm trying to decode this piece of code...

        private val intentFilter: ObservableTransformer<BrowseIntent, BrowseIntent> =
                ObservableTransformer<BrowseIntent, BrowseIntent> {
                    it.publish {
                        Observable.merge(it.ofType(BrowseIntent.InitialIntent::class.java).take(1),
                                it.filter({ intent -> intent !is BrowseIntent.InitialIntent }))
                    }
                }

    Is my understanding correct that this transformer is basically trying to ensure that the InitialIntent is published only once (whenever it occurs). Post that, it will never be published ever again?

    David Karnok
    @akarnokd
    @PrashantSinghal Looks like so; it will make sure at most one InitialIntent value is passed along.
    Prashant Singhal
    @PrashantSinghal
    Thanks @akarnokd .
    Carlo Xavier Lopez S
    @carloxavier_twitter
    Hi! some peers in our repo started using CompositeDisposable being injected from dagger, as a shared instance
    do you see some downside to this?
    for example, one benefit is to be able to clear the disposables on the activity/fragment lifecycles
    Justin Tuchek
    @justintuchek
    I've seen this before. You could maybe say that it increases testability because you can mock and validate that your subscriptions are cleared/disposed.
    Think it's harder to reason about who's subscriptions/disposables are you clearing because you first need to see if the thing is a Singleton or not and then try to figure out who else may be using it so you don't clobber somebody else's stream unintentionally.
    Carlo Xavier Lopez S
    @carloxavier_twitter
    good point thanks @jtuchek
    defaultbr
    @defaultbr

    someone can say if this make sense:

          checkCode(code)
                                .flatMap {
                                    response ->
                                    if(response.isSuccessful) {
                                        saveSetupToDatabase(response.body()!!)
    
                                        fetchCompaniesSetup(response.body()!!.imeirecord.oid)
    
                                                .flatMap { response ->
                                                    if(response.isSuccessful) {
                                                        saveCompaniesToDatabase(response.body()!!)
                                                    }
                                                        Observable.just(response)
    
                                                }
                                    } else {
                                        Observable.just(response)
                                    }
                                }
    
                                .subscribeOn(scheduler.io())
                                .observeOn(scheduler.ui())
                                .subscribe(
                                        { response ->
                                            if (response.isSuccessful) {
                                                println("sucess no 1")
                                                view?.hideLoading()
                                                view?.dataSaved()
                                            } else {
                                                println("handle retrofit errorbody2")
                                                view?.hideLoading()
                                                handleErrorBody(response)
                                            }
                                        },
                                        {   it ->
                                            println("handle exception")
                                            view?.hideLoading()
                                            handleException(it)
                                        }
    
                                )

    for some reason i think its wrong, i dont know why, is there a better way?

    Halim Dev
    @halimpuckjava
    hi, how i logger in console any events (onsubscribe, onext, onerror, oncomplete) come from observable with rxjava ?? there a LOG operator for reactor but for rxjava there is some think like this ???
    Joshua Street
    @jjstreet
    hello all
    hopefully have a simple question
    i have a class that acts as a client, returning singles
    i want poll with this single
    public Flowable<List<String>> poll() {
        return this.client.getData(this.host)
                .subscribeOn(this.scheduler)
                .retryWhen(errors -> Flowable.timer(this.retryDelay, TimeUnit.MILLISECONDS, this.scheduler))
                .repeatWhen(success -> success.delay(this.delay, TimeUnit.MILLISECONDS, this.scheduler));
    }
    this is how i have setup my polling method
    i have a working test for repeatWhen
    but my problem is trying to write a test for retrying
    i can't figure out if i have working
    Joshua Street
    @jjstreet
    hmm this works