Questions tagged [rx-java3]
149 questions
15
votes
1 answer
Why is doOnDispose not called?
When creating an Observable like this:
public void foo() {
Observable observable = Observable.fromCallable(() -> {
bar();
return "";
})
.doOnSubscribe(disposable -> System.out.println("onSubscribe"))
…

fweigl
- 21,278
- 20
- 114
- 205
13
votes
3 answers
io.reactivex.exceptions.UndeliverableException The exception could not be delivered to the consumer because it has already canceled/disposed
Getting an UndeliverableException while using completable
public Completable createBucketWithStorageClassAndLocation() {
return Completable.complete()
.doFinally(() -> {
Bucket bucket =
…

San Jaisy
- 15,327
- 34
- 171
- 290
6
votes
1 answer
How to convert a suspend function to an RX Single (or Completable)?
We're refactoring our project from RX to Kotlin Coroutines, but not in one go, so we need our project use both for some time.
Now we have a lot of methods that use RX single as a return type like this, because they are heavy, long running…

Adam Kis
- 1,404
- 14
- 17
6
votes
4 answers
RxJava 3 support for Room
I am using RxJava3 with Room in my project but I am getting the following error
error: Not sure how to convert a Cursor to this method's return type (io.reactivex.rxjava3.core.Flowable>)
Below is DAO interface method on which I am getting the…

Fire_Icicle
- 121
- 2
- 9
4
votes
1 answer
retrofit2 and rxjava3: java.lang.IllegalArgumentException: Could not locate call adapter for io.reactivex.rxjava3.core.Observable
I want to use retrofit2 and rxjava3 but I see the following error
Caused by: java.lang.IllegalArgumentException: Could not locate call adapter for io.reactivex.rxjava3.core.Observable.
Tried:
*…

abolfazl bazghandi
- 935
- 15
- 29
3
votes
3 answers
Build "Heartbeat" Observable from Unpredictable Source Observable
I have an Observable, source, that may emit items at unpredictable times. I'm trying to use it to build another Observable that reliably emits its values every 500ms.
Let's say that source emits values at these times:
100ms - first item
980ms -…

Jameson
- 6,400
- 6
- 32
- 53
3
votes
1 answer
Why doesn't Flowable.subscribe(Subscriber) return a Disposable?
Most of the Flowable.subscribe() overloads return a Disposable which enable a flow to be cleaned up. I'm in the habit of doing:
Disposable d = Flowable.just()
.map(...)
.subscribe(
n -> ...
t -> ...
() -> ...
…

Dan Gravell
- 7,855
- 7
- 41
- 64
3
votes
1 answer
Rxjava 3 + Retrofit2 - multiple inserts to DB problem
I am trying to do the following; sync a cloud DB using Retrofit to a local SqLite DB (Room) on a device. The DB could get large, around 100,000 registers or more, so the sync process can take some time. So it send a first Retrofit request to get the…

MarioV
- 108
- 11
2
votes
1 answer
How do I check in an operator that current element is last element?
Context:
To process a Flowable- , I need to first process the first item and then depending on that either accumulate all items into a single item (reduce) OR apply a simple map on each item without any accumulation (map).
One way I can think of…

gGwP
- 35
- 1
- 6
2
votes
0 answers
Unwanted garbage collection while calling from the method that ends
Spring Boot app, where Spring Boot's scheduled method calls RX method (rxjava3) to do the long job (in separate thread pool).
@Scheduled(fixedDelay = ONE_SECOND)
public void init() {
process().subscribe(); // it returns Disposable
}
Imagine if…

ses
- 13,174
- 31
- 123
- 226
2
votes
1 answer
flatMap and flatMap single for groupped observables
I am new in RxJava and trying to understand it. I have the following source:
Observable obs = Observable.just(
new Employee(101, "Jim", 68_000, 4.2),
new Employee(123, "Bill", 194_000, 6.7));
obs.groupBy(e -> e.getRating())
…

Jim
- 3,845
- 3
- 22
- 47
2
votes
1 answer
Why doesn't my Android ViewModel's Room RxJava3 Flowable publish any result when my Activity is paused?
I'm aware it's a complex question that cannot have a definite answer without posting a few hundreds of lines of code, which is why I'm looking for help through general ideas and pointers.
I have a Room @Query returning a RxJava3 Flowable
- >…

Pat Lee
- 1,567
- 1
- 9
- 13
2
votes
1 answer
rxJava how to make flatMap run on multi threads
I want every item emitted from flatMap to run on its own thread
This is a simplified example of a real usage where each item will be a url request.
Adding subscribeOn(Schedulers.io()) on each single still run on a single thread
What's the rule…

BabyishTank
- 1,329
- 3
- 18
- 39
2
votes
1 answer
rxjava combines 2 calls with error handling, fails with delay
The use case is,
there are 2 sources of the data:
Service 1 - fetches from source-1
Service 2 - fetches from the source-2
The app should return data at least from source-1. If all is fine with source-2 - the data will be "enhanced", say multiplied…

ses
- 13,174
- 31
- 123
- 226
2
votes
1 answer
How to handle error when using @Client interface in Micronaut
new to Micronaut and am wondering how people are handling errors. The example in the documentation uses blocking which I do not want to use to handle errors. Basically, what i'd like to do is be able to detect if error and if so, convert it to…

Ricardo Riveros
- 233
- 3
- 11