Questions tagged [rx-java2]

anything related to RxJava2 – The new implementation of the RxJava Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.

RxJava2 is the new implementation of the RxJava Reactive Extensions for the JVM – RxJava2 is a library for composing asynchronous and event-based programs using observable sequences for the Java VM.

It extends the observer pattern to support sequences of data/events and adds operators that allow you to compose sequences together declaratively while abstracting away concerns about things like low-level threading, synchronization, thread-safety and concurrent data structures.

4140 questions
1
vote
2 answers

RxJava: upstream never completes when error is swallowed

I'm using RxJava to iterate over a list of files, making a network call to upload each file, then collect the files that were successfully uploaded in a list and persist those files in the subscriber on success. This code works, except for when an…
Jeff Lockhart
  • 5,379
  • 4
  • 36
  • 51
1
vote
1 answer

How to wait to finish all the task in doOnNext before calling the doOnComplete?

just asking if I am doing it correct, because I don't know why the doOnComplete is calling while the doOnNext is not yet finish? So that's why, I am asking on how to wait all the task inside the doOnNext before calling the doOnComplete? The other…
dotGitignore
  • 1,597
  • 2
  • 15
  • 34
1
vote
1 answer

Test Single delay

I am trying to skip Single.delay() and my test falls with error: java.lang.AssertionError: Not completed (latch = 1, values = 0, errors = 0, completions = 0) val testScheduler = TestScheduler() RxJavaPlugins.setComputationSchedulerHandler {…
1
vote
1 answer

take(n) doesn't have effect after groupBy in RxJava2

I am trying to group several model instances by name and then use take(n) to take only certain items per group, but somehow the take has no effect on GroupedObservable. Here is the code Let's assume this contains a list with 10 items and 5 have the…
X-HuMan
  • 1,488
  • 1
  • 17
  • 37
1
vote
1 answer

Rx Subject can't use observeOn() operator

I've declared: Subject mBehaviorSubject = BehaviorSubject.createDefault("default").toSerialized(); Seems to work fine. But I now want to add .observeOn(AndroidSchedulers.mainThread(). This is rejected because Android Studio wants to see a…
Robert Lewis
  • 1,847
  • 2
  • 18
  • 43
1
vote
1 answer

How to combine following Observables into one in Kotlin?

I have these two Observables in Kotlin where is just act as a timer and another one is HTTP network call response Observer. timerDisposable = Observable.timer(daleyABCControlResetSeconds, TimeUnit.SECONDS, AndroidSchedulers.mainThread()) …
Ahmed S. Durrani
  • 1,535
  • 2
  • 17
  • 41
1
vote
1 answer

RxJava2 delaySubscription do now

I have an operation with delay: mySingle.delaySubscription(60, TimeUnit.SECONDS).subscribe(); If for some reason after scheduling such a delay I want to perform an operation now, how can I do that? What I see, I can get Disposable from my…
Goltsev Eugene
  • 3,325
  • 6
  • 25
  • 48
1
vote
2 answers

How to get multiple data type from Observable since only one generic type from Observable accepted

We already know that Observable can only have one argument as its generic type. Observable I assume that I have 2 network calls which return 2 data type: UserResponse and WorkResponse. And I want to call 2 these APIs step by step, getUser then…
LuongPham
  • 81
  • 10
1
vote
1 answer

explicit return type when using rxjava2 completable in lambda expression

Android Studio 3.3 RxJava 2 I am having trouble understanding the explicit return for a lambda. For example I am using clean architecture and in my data layer I have the following interface and implementation (which don't return any…
ant2009
  • 27,094
  • 154
  • 411
  • 609
1
vote
1 answer

How to implement scheduler inheritance when another source tees into a pipeline?

I'd like to implement "scheduler inheritance" as part of an RxJava2-using API. I want consumers of my API to be able to think in terms of building a single processing chain rather than a DAG, even though, internally, new events are being teed in as…
Jeremy W. Sherman
  • 35,901
  • 5
  • 77
  • 111
1
vote
2 answers

Could you tell me what's wrong with the following Subscription example?

The following Subscription doesn't work at all, When Click a refresh Button. There is no printed Logs indicate that is there any API called. -Notes: All Dependencies done using dagger2, and Retrofit instance created like this: @AppScope …
Hussein Ahmed
  • 730
  • 2
  • 7
  • 17
1
vote
0 answers

RxJava 2 inner flatMapCompletable doesn't call subscriber's following chain

I've faced to some strange behavior of flatMapCompletablefunction. In the code snippet below I have multiple inner flatMapCompletable. Line marked with * doesn't call code in andThan. Although any other compellable in this code successfully executes…
Ening
  • 455
  • 3
  • 19
1
vote
2 answers

RxJava 2 - How do you only do an action for first click event, and then restart after event occurs?

I have a button. If a user presses on it several times, I want it to run a method only when it receives the first click. After the method is finished running and done, I want to listen for button clicks again and do the action only when we receive…
user7281939
1
vote
0 answers

In a chain of RxJava Request, how to skip the first request if it already returned success?

For example I have two network request: Single firstRequest = firstCall() Single secondRequest = secondCall() Now, the Second should only be called when the first is successful, so I do something…
Archie G. Quiñones
  • 11,638
  • 18
  • 65
  • 107
1
vote
1 answer

RxJava - Run two observables sequentially, using result from first observable in second observable

I have ServerTime class: public class ServerTime { private String time; public ServerTime(String time) { this.time = time; } public String getTime() { return time; } } And ServerNetwork class: public class…
silent_coder14
  • 583
  • 2
  • 10
  • 38